zenda interview question

Palindrome leet code problem and optimise it