Question DSA-STR-0049
MediumHow can you check whether s2 is a rotation of s1 (same length)?
- A.
Reverse s1 and compare
- B.
Sort both
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Strings question
How can you check whether s2 is a rotation of s1 (same length)?
Reverse s1 and compare
Sort both
Sign up free to see the answer and a step-by-step explanation.
Compare the first characters
Check whether s2 is a substring of s1 + s1