Advertisement
nikunjsoni

80

Apr 15th, 2021
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int removeDuplicates(vector<int>& nums) {
  4.         int i = 0;
  5.         for (int n : nums)
  6.             if (i < 2 || n > nums[i-2])
  7.                 nums[i++] = n;
  8.         return i;
  9.     }
  10. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement