Strings

Master string manipulation with pattern matching, parsing, and advanced string algorithms.

Showing 20 of 20 questions
Easy: 0 Medium: 0 Hard: 0
QUESTIONDIFFICULTY
Valid Anagram
Determine if two strings are anagrams of each other
Easy
Check if String is Palindrome
Determine if a string reads the same forwards and backwards, ignoring case and non-alphanumeric characters.
Medium
Check if String is Rotation of Another
Determine if one string is a rotation of another string by checking if it can be formed by rotating the characters.
Medium
Count and Say
Generate the nth term of the count-and-say sequence.
Medium
Edit Distance (Levenshtein Distance)
Find the minimum number of operations (insert, delete, replace) required to transform one string into another.
Medium
First Unique Character in String
Find the first non-repeating character in a string and return its index.
Medium
Generate Permutations
Generate all possible permutations of a given string.
Medium
Group Anagrams
Group strings that are anagrams of each other together.
Medium
Implement strStr (Find Substring)
Find the first occurrence of a substring in a string, similar to strstr() function.
Medium
Longest Common Prefix
Find the longest common prefix string amongst an array of strings.
Medium
Longest Palindromic Substring
Find the longest palindromic substring in a given string
Medium
Longest Substring Without Repeating Characters
Find the length of the longest substring without repeating characters
Medium
Reverse String
Reverse a string in-place using O(1) extra memory.
Medium
String Compression
Compress a string by replacing consecutive characters with character and count.
Medium
Valid Parentheses
Check if a string containing only parentheses is valid.
Medium
Word Break
Determine if a string can be segmented into space-separated words from a dictionary.
Medium
Longest Repeated Substring
Find the longest substring that appears at least twice in a string
Hard
Minimum Window Substring
Find the minimum window substring that contains all characters of another string
Hard
Regular Expression Matching
Implement regular expression matching with support for . and *
Hard
Smallest Substring with All Characters
Find the smallest substring that contains all characters of a given pattern
Hard

Overview

String manipulation is a crucial skill for coding interviews. This section covers fundamental string operations, pattern matching, and advanced algorithms.

Key Concepts

  • String traversal and iteration
  • Two-pointer technique
  • Sliding window
  • String building and concatenation
  • Pattern matching
  • Palindromes and anagrams

Common Problems

Easy

  • Valid Palindrome
  • Valid Anagram
  • Reverse String
  • First Unique Character

Medium

  • Longest Substring Without Repeating Characters
  • Longest Palindromic Substring
  • Group Anagrams
  • String to Integer (atoi)

Hard

  • Minimum Window Substring
  • Regular Expression Matching
  • Wildcard Matching

Practice Tips

  1. Use StringBuilder: For string concatenation in loops
  2. Character arrays: Sometimes easier to manipulate than strings
  3. ASCII values: Useful for character comparisons
  4. Edge cases: Empty strings, single characters, special characters

Resources