字符串
Data Structures & Algorithms · 7 notes
- String Permutationshistorical
Given a string, print all permutations of its characters in lexicographic order. For example, given the string abc, print all strings formed by a, b, and c in lexicographic order: abc, acb, bac, bca, cab, and cba.
- First Non-Repeating Character in a Character Streamhistorical
Implement a function that finds the first character that appears only once in a character stream. For example, after reading only the first two characters "go", the first character that appears once is "g".
- Left Rotate Stringhistorical
Assembly language has a shift instruction called rotate left (ROL). This task uses a string to simulate its result. Given a character sequence S, output the sequence after cyclically rotating it K positions to the left.
- Poker Straighthistorical
Determine whether five playing cards can form a straight, allowing jokers to represent any number.
- Replace Spaceshistorical
Implement a function that replaces every space in a string with "%20". For example, when the string is We Are Happy., the result after replacement is We%20Are%20Happy.
- Convert a String to an Integerhistorical
Convert a string to an integer without using a library function that converts strings to integers. Return 0 if the value is 0 or if the string is not a valid numeric value.
- Reverse Word Orderhistorical
Reverse the order of words in an English sentence while preserving the character order within each word.