v1 time O(n^2) space O(1) Accepted