Created
May 6, 2015 08:29
-
-
Save ik11235/ad4a3c2127668e7cdaa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InfiniteString { | |
public: | |
string equal(string s, string t) { | |
int i=0,j=0; | |
while(i<s.size() && j<t.size()) | |
{ | |
if(s[i]!=t[j]) | |
return "Not equal"; | |
if(i==s.size()-1 && j==t.size()-1) | |
break; | |
i++; | |
j++; | |
if(i>=s.size()) | |
i=0; | |
if(j>=t.size()) | |
j=0; | |
} | |
return "Equal"; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment