Given the string, check if it is a palindrome.
Example
- For
inputString = "aabaa"
, the output should be
solution(inputString) = true
; - For
inputString = "abac"
, the output should be
solution(inputString) = false
; - For
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
ifinputString
is a palindrome,false
otherwise.
[Java] Syntax Tips
// Prints help message to the console // Returns a string // // Globals declared here will cause a compilation error, // declare variables inside the function instead! String helloWorld(String name) { System.out.println("This prints to the console when you Run Tests"); return "Hello, " + name; }
-
CodeSignalSolutions/Check_Palindrome/Check_palindrome.js
Lines 1 to 10 in a7481de
-
CodeSignalSolutions/Check_Palindrome/Check_palindrome.java
Lines 1 to 14 in a7481de