Dsa
Strings
Warm-up
String Rotation Checker
You are given two strings. Your task is to determine if the second string is a rotation of the first string. A rotation means that the second string can be obtained by moving some characters from the start of the first string to the end, in the same order. If both strings are equal, return 'Yes'. If they are not of the same length, return 'No'. Otherwise, return 'Yes' or 'No' based on the rotation check.
Example Input:
abcd, cdab
Example Output:
Yes
Key concepts
stringsrotationchecking
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now