Ad
  • Default User Avatar
  • Custom User Avatar

    same question somoene help?

  • Default User Avatar

    Hi,

    For how long after getting n values in the set, do I have to keep calculating the numbers of the sequence?

    Since smaller sequence number might come later, how do I decide when to stop calculating? Really need help generalizing this since as the n becomes large(n is going upto 600,000 in test cases), you need to keep calculating sequence way after n numbers of the sequence are calculated. Any hint or suggestion? (I might have misunderstood the problem as well, so please help!)

  • Custom User Avatar

    If in a simple case you find that you're printing (visiting) the same element more than once, then its likely that you dont have a O(n) solution.

  • Default User Avatar

    The problem is with the larger test cases where it suffers "Execution Timed Out" error. Could you elaborate how print statement would help here? Thanks!

  • Custom User Avatar

    How about adding some print statements to debug exactly what elements and indices you're looking at for a simple case?

  • Default User Avatar

    Took me 2 evenings to solve this one and was really hard to get my head around. Suggest searching the web for "python function closure" as your next port of call.

  • Default User Avatar

    Can someone please translate this for python? Thank you. I realised python is not there only after solving it lol.

  • Default User Avatar

    Yeah, I did that! took some time to observe this though after first attempt(using itertools permutations) timed out on larger numbers.

  • Default User Avatar

    As strings, '2000' comes before '11' and both have a weight of 2 in input "2000 10003 1234000 44444444 9999 11 11 22 123" but in answer they want '11' before '2000' and then '10003' before '22', and these logic contradicts each other!

    Could you explain how is the output correct?

    Got it! Where can I look for this fundamental concept? (i.e. how str(number) is ordered?, i.e. why '10003' <'22') Thanks!

  • Default User Avatar

    For all asking, timeout during tests is not issue. There are few ways to simplify input data

  • 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