• Custom User Avatar

    Thank you, that suggestion helped along with following the input constraints.

  • Custom User Avatar

    Not sure this is the point that makes your program fail, but instructions like next_num in lst of lst.pop(0) are very expensive (in the first case, it may be necessary to parse the whole list to check wether the number is in, in the second case, theoretically it requires to reallocate the whole list each time the operation is performed). You may try to find more suitable datastructures for those operations...

  • Custom User Avatar

    My code works but it doesn't meet the 12 second time limit. Any ideas on improving it?