Skip to content

Instantly share code, notes, and snippets.

@ilpropheta
Created June 4, 2016 13:23
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 ilpropheta/212de4906c4b4908b3f88f8b318177c2 to your computer and use it in GitHub Desktop.
Save ilpropheta/212de4906c4b4908b3f88f8b318177c2 to your computer and use it in GitHub Desktop.
if (equal(begin(S), begin(S) + S.size()/2, rbegin(S))) // is palindrome?
cout << diffIdx << endl;
else
cout << S.size() - diffIdx - 1 << endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment