Skip to content

Latest commit

 

History

History
19 lines (18 loc) · 396 Bytes

Check if strings are rotations of each other or not.md

File metadata and controls

19 lines (18 loc) · 396 Bytes
class Solution
{
    public:
    //Function to check if two strings are rotations of each other or not.
    bool areRotations(string s1,string s2)
    {
        if(s1.size() != s2.size())
            return false;
        string temp = s1 + s1;
        
        if(temp.find(s2)!= string::npos)
            return true;
        return false;
    }
    // geekforgeeks
// forgeeksgeek
};