[Solved] runtime of using [::-1] on a list [closed]
[ad_1] list.reverse operates in place. That means that it almost certainly does something like this under the hood: for i in range(len(self) // 2): j = len(self) – 1 – i self[i], self[j] = self[j], self[i] The actual method is implemented in C, so of course it will be much more verbose, especially in the … Read more