This video is part of the String section under the GFG SDE Sheet.
In this problem, we are given two strings a and b. The task is to find if the string 'b' can be obtained by rotating (in any direction) string 'a' by exactly 2 places.
Example :
Input:
a = amazon
b = azonam
Output:
1
Explanation:
amazon can be rotated anti-clockwise by two places, which will make it as azonam
Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!
Do check out:-
Article: https://www.geeksforgeeks.org/check-string-can-obtained-rotating-another-string-2-places/
Problem: https://www.geeksforgeeks.org/problems/check-if-string-is-rotated-by-two-places-1587115620/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/