Ad
  • Default User Avatar

    You're welcome, glad it helped debug a bit.

    I have further edited my comment now to remove all code-related info, that way it doesn't spoil for other users.

  • Default User Avatar

    I did not see this zero because in the basic test, exactly the same without a zero, thanks :D

  • Default User Avatar

    As the IndexError suggests, you are trying to access an index which "doesn't exist": In your code, you have a part where you write:

    res = ...

    (I have hidden the rest, so I don't have to spoiler this comment; I hope it is clear what I mean.)

    Take this entire expression, and print it to console in the line before calling that res = ... line:

    So add this print statement:

    print("TEST -->>> ", ### here insert the expression you are using to find res ### )

    You will see what is going wrong in your console - for input [48, 9, 3, 0, 67] you will reach a point where you get:

    TEST -->>> ['']

    This then fails when you use the following code later on in your program:

    str(i)[0] <--- what happens if index 0 does not exist?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    thanks, I misunderstood the condition

  • Custom User Avatar

    Because there is only one 0 and one 5 there? You should use the digits of the number 105881.

  • Default User Avatar

    As 937 * 113 = 105881 and the largest palindromic number that can be arranged from the digits of result is: 81518

    why answer not 105501?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Yes, I already found another algorithm, and the program is 80 times faster, but I still can't pass these tests 😅

  • Default User Avatar

    Hi; the maximum number used in random tests seems to be around 10**19 as far as I can tell.

    In any case, it is probably way too big for your current approach (I don't want to give away spoilers in my comment, but consider how many different strings you may need to examine using your approach).

    I can't read your RU comments but I don't think you can "accelerate" this approach by orders of magnitude away with micro-optimisation; so you need a different algorithm.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Because 1234567980 (your solution) is not the next bigger number after 1234567890 (the input) ???

    You can write them down:

    1234567890 # input
    1234567891 # +1
    1234567892 # +2
    ...
    1234567900 # +10
    1234567901 # +11
    ...
    1234567908 # +18, AND THE FIRST TIME WE ENCOUNTER A BIGGER NUMBER WITH THE SAME DIGITS AS THE INPUT VALUE
    ...
    1234567978 # +88
    1234567979 # +89
    1234567980 # <- your solution, which does have same digits as input, BUT is bigger than 1234567908 --^
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Bigger numbers:
    Time of your function -0.0001659393310546875
    Time of your function -0.00020432472229003906

    Execution Timed Out (12000 ms)

    how it possible?

  • Loading more items...