Ad
  • Custom User Avatar

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

  • Custom User Avatar

    I'm not sure if there's a name for it. I'm using it here because otherwise int('') would throw an error, but '' also evaluates to false, so using or here lets me coerce '' to 0.

  • Custom User Avatar

    You may want to read on the topic of 'Time Complexities' in code (Also search for 'Big O notation'). The tests in this kata are so large that you pretty much need to have an algorithm that is O(n) - which means it looks at each element of the original list only once.

    To do even one single reverse requires looking at each element once, so if you use it even a couple times, your algorithm is probably too slow.

    pop() is nice and fast, but taking elements from the front (pop(0)) means that all other elements have to be moved up one index, so it is also O(n). There are clever ways around this, but I won't tell you what they are. (Google might be your friend. You are looking for 'constant time operations')