Discussion
Do not post solutions here. This page is intended only to ask questions about problem, tips if you stuck or discuss problem in general.
Loading
Just a moment, getting data from the server
I think the provided test case is incorrect. Let n be the "palindrome level" counter:
865 is not a palindrome so 865 + 568 = 1433 (n = 1)
1433 is not a palindrome so 1433 + 3314 = 7474 (n = 2).
And this is where the program stops in the test case. But 7474 is obviously not a palindrome either.If we repeat the operation a third time we get: 7474 + 4747 = 12221 which IS a palindrome. Therefore, n = 3 is the answer.Am I missing something?
elliotalders0n I think on the step two it should be 1433 + 3341 and not 3314. And 1433 + 3341 would give you 4774, which is a palindrome :)