A very Pythonic solution, with list slicing and pythonic swapping Be super careful with the edge cases Time complexity: O(n), as slicing a list will create new list Check https://github.com/python/cpython/blob/master/Objects/listobject.c line 473 to 493
source not stored for this graph (policy: none)