Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int removeDuplicates(vector<int>& nums) {
- int i = 0;
- for (int n : nums)
- if (i < 2 || n > nums[i-2])
- nums[i++] = n;
- return i;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement