Skip to content

Instantly share code, notes, and snippets.

@ik11235
Created May 6, 2015 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik11235/ad4a3c2127668e7cdaa0 to your computer and use it in GitHub Desktop.
Save ik11235/ad4a3c2127668e7cdaa0 to your computer and use it in GitHub Desktop.
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