Array Part2
Two pointers 977 Squares of a Sorted Array We can use two pointers to read the positive and negative parts of the array - one pointer j in the positive direction, and another i in the negative direction. Now that we are reading two increasing arrays (the squares of the elements), we can merge these arrays together using a two-pointer technique. 11 Container With Most Water O(N) time and O(1) space, since better candidadates must use the taller line of l and r therefore we can use two pointer keep moving towards each other until they meet. Always abandon the shorter line while moving. 80 Remove Duplicates from Sorted Array II tail = 0; for (int i = 0; i < nums.size(); i++) if (i < 2 || nums[i] > nums[tail - 2]) // not included twice yet nums[tail++] = nums...