Skip to content

Instantly share code, notes, and snippets.

@hikilaka
Created February 24, 2017 00:43
Show Gist options
  • Save hikilaka/6d4e4b88ba873108034888f92fe0dff6 to your computer and use it in GitHub Desktop.
Save hikilaka/6d4e4b88ba873108034888f92fe0dff6 to your computer and use it in GitHub Desktop.
bool checkPalindrome(std::string inputString) {
auto begin = inputString.begin();
auto end = inputString.end();
auto rbegin = inputString.rbegin();
for (; begin != end;) {
if (*begin != *rbegin) {
return false;
}
begin = std::next(begin);
rbegin = std::next(rbegin);
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment