Given the string, check if it is a palindrome.
Example
inputString = "aabaa", the output should be**solution(inputString) = true**;inputString = "abac", the output should be**solution(inputString) = false**;inputString = "a", the output should be**solution(inputString) = true**.Input/Output
[execution time limit] 3 seconds (java)
[memory limit] 1 GB
[input] string inputString
A non-empty string consisting of lowercase characters.
Guaranteed constraints:
1 ≤ inputString.length ≤ 105.
[output] boolean
true if inputString is a palindrome, false otherwise.
boolean solution(String inputString) {
if (inputString.length() == 1) return true;
char [] arr = inputString.toCharArray();
int idx = arr.length - 1;
for (int i = 0; i < arr.length / 2; i ++) {
if (arr[i] != arr[idx--]) return false;
}
return true;
}