Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. Return k after placing the final result in the first k slots of nums.
Two Pointers
Allow at most 2 of each — check against nums[k-2] instead of nums[k-1].