DriveReady

P01 — Strings — every solution explained

This lesson is part of full access

One payment of ₹250 opens every lesson, practice set and mock for all five companies. No subscription, no expiry.

What is inside

  • 1. Reverse each word, keep word order
  • 2. Count vowels and consonants ->
  • 3. Palindrome ignoring case and non-alphanumerics
  • 4. First non-repeating character, or '\0'
  • 5. Capitalise the first letter of each word
  • 6. Remove duplicate characters, preserving first-seen order
  • 7. Longest word; ties -> the first one
  • 8. Word count, tolerant of runs of spaces and of an empty string
  • 9. Main diagonal of the N x N row-major grid built from s
  • 10. Anagram check
  • 11. Run-length compress: aaabb -> a3b2. Singles keep no digit: abc -> abc
  • 12. Sum of all digit characters
  • 13. Extract every run of digits as a number
  • 14. Balanced brackets