You are viewing a single comment's thread. Return to all comments →
This problem can be solved without explicitly finding the reverse of the string.
bool is_funny(string &s) { for ( int i = 0, j = s.length() - 1 ; i <= j ; ) { if ( abs(s[i] - s[++i]) != abs(s[j] - s[--j]) ) return false; } return true; }
Seems like cookies are disabled on this browser, please enable them to open this website
Stone Piles
You are viewing a single comment's thread. Return to all comments →
This problem can be solved without explicitly finding the reverse of the string.