So, you’re looking to get better at coding interviews, huh? Maybe you’ve heard about LeetCode and feel a bit lost. It’s ...
//Use three pointers and so you can change the next of the mid to the first one without losing the track of the original left.
print(timeit.timeit(lambda x=[1, [2, [3, [4]]]]: sum_nested(x))) # 5 secs print(timeit.timeit(lambda x=[1, [2, [3, [4]]]]: sum_nested2(x))) # 3 secs print(timeit ...