4

SDE Sheet - Check if String is rotated by two places

 8 months ago
source link: https://www.geeksforgeeks.org/videos/sde-sheet-check-if-string-is-rotated-by-two-places-1/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Check if String is rotated by two places

December 28, 2023 |30 Views
SDE Sheet - Check if String is rotated by two places
SDE Sheet, GFG SDE Sheet, String
 Save  Share   Like
Description
Discussion

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/

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK