write a program to check whether it is a palindrome or not ?
Input : 12321
output : it is a palindrome
input : mam
input : 12345
output: not a palindrome
Discussion posts and replies are publicly visible
Another one ... really !?!?! What did your try so far?
Atleast give it a try before posting here.
a!localVariables( local!input: char(code(ri!input)), local!reverse: reverse(local!input), and(local!reverse = local!input) )
Use this - https://chat.openai.com/Would save your and our time.
sigh, i've been avoiding trying this thing out, but...
I tried this logic, its not working for number like 121, 1331.
Then try it again. It still works perfectly for any palindrome.
/* two pointer approach */
a!localVariables( local!text: "12121", local!count: ceiling(len(local!text) / 2), and( a!forEach( items: enumerate(local!count), expression: local!text[fv!index] = local!text[len(local!text) - fv!index + 1] ) ))