Solution 1 direct swap

  • t-complexity: $O(n)$

  • s-complexity: $O(1)$

Last updated