Palindrome test

Report a typo

A palindrome is a word or group of words that remains the same whether you read it forwards from the beginning or backwards from the end: "refer" and "level" are palindromes. Using the FIFO and LIFO strategies, write a function that returns true if a word is palindrome or false if not.

Sample Input 1:

refer

Sample Output 1:

true
Write a program in Kotlin
fun isPalindrome(word: String): Boolean {
val deque = ArrayDeque<Char>()

for (char in word) {
deque.addLast(char)
}

while (deque.size > 1) {
// make your code here
}

return true
}
___

Create a free account to access the full topic