Nivel de palíndromo#29

Nivel de palíndromo (Discusión)

  1. dendi23918 dic 2024, 18:12

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

  2. elliotalders0n28 sept 2024, 10:59editado

    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. MStrechen30 sept 2024, 7:25

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