The level of palindrome#29

The level of palindrome (Discussion)

  1. dendi239Dec 18, 2024, 6:12 PM

    Цей процес не завжди закінчується, наприклад для 196 (перевіряйте з довгою арифметикою)

  2. elliotalders0nSep 28, 2024, 10:59 AMedited

    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?

    1. MStrechenSep 30, 2024, 7:25 AM

      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 :)