midStrings
Check if one string is a rotation of another.
Updated Apr 28, 2026
Short answer
Concatenate the string with itself (s1 + s1) and check if s2 is a substring.
Deep explanation
Intermediate string problems test your ability to use frequency maps and sliding windows. Concatenate the string with itself (s1 + s1) and check if s2 is a substring.
Real-world example
Search filters that ignore character order.
Common mistakes
- Inefficiently sorting strings for an anagram check when a frequency map is O(n).
Follow-up questions
- What is the time complexity of sorting?