Check whether a string is palindrome

1 min read

https://practice.geeksforgeeks.org/problems/palindrome-string0817/1

class Solution {
public:
  int isPlaindrome(string S) {
    int n = S.size();

    for (int i = 0; i < n / 2; i++) {
      if (S[i] != S[n - i - 1])
        return false;
    }

    return true;
  }
};
Common elements in all rows of a given matrix
Find duplicate characters in a string