Strings practice problems
Text as data: build it, slice it, check it, reshape it. A concept: the material itself — what it is, and what it costs you to use. 37 problems in the bank train it, each with a worked example, a hint and a reference solution.
- Math
- Strings
- Arrays
- Hash maps
- Sorting
- Parsing
- Two pointers
- Sliding window
- Prefix sums
- Stacks
- Binary search
- Intervals
- Grids
- Greedy
- Recursion
- Simulation
- Bit manipulation
37 problems
- Palindrome checkeasy
- Initials for an avatareasy
- Mask a card numbereasy
- Tidy up pasted texteasy
- Hide most of an email addresseasy
- Read a quantity someone typedeasy
- Balanced delimiterseasy
- Mirror text, ignoring the cluttereasy
- Reverse the order of the wordseasy
- Is this address complete enough to shipeasy
- Score a word by letter positionseasy
- Did they type the letters in ordereasy
- How deep does this nesteasy
- Write the field out in binaryeasy
- Split one CSV line properlyhard
- Wrap text to a label widthhard
- Compare two version stringshard
- Longest stretch with no repeathard
- The longest run with only two kindshard
- Tidy up a file pathhard
- Format money for a receiptmedium
- Luhn check a card numbermedium
- Turn a product title into a URL slugmedium
- Cut a description to lengthmedium
- Count the words that mattermedium
- Title-case a headingmedium
- Say a duration the way a person wouldmedium
- Read a duration a human typedmedium
- Count log lines by levelmedium
- Score a passwordmedium
- Normalise a phone numbermedium
- Verify a barcodemedium
- The most repeated wordmedium
- Are these two an anagrammedium
- Write a number in Roman numeralsmedium
- Classify a latency measurementmedium
- Cancel out the doubled keystrokesmedium