字符串
Data Structures & Algorithms · 7 notes
- String Permutationshistorical
Generate all string permutations using recursive backtracking, deduplicate them, and sort them lexicographically.
- First Non-Repeating Character in a Character Streamhistorical
Use a map to count character occurrences while preserving input order to find the first character that appears only once in a stream.
- Left Rotate Stringhistorical
Record two implementations of cyclic left rotation of a string: slicing and concatenation, and three reversals.
- Poker Straighthistorical
Sort five cards, treat jokers as 0, and use the gaps between non-zero cards to determine whether they can form a straight.
- Replace Spaceshistorical
Record two implementations for replacing spaces with %20: character-by-character concatenation and preallocated storage.
- Convert a String to an Integerhistorical
Record character parsing and atoi implementations for converting a string to an integer.
- Reverse Word Orderhistorical
Record methods for reversing word order by splitting the string and by reversing twice.