Remove Duplicates from Sorted Array
int[] nums = [...]; // Input array
int[] expectedNums = [...]; // The expected answer with correct length
int k = removeDuplicates(nums); // Calls your implementation
assert k == expectedNums.length;
for (int i = 0; i < k; i++) {
assert nums[i] == expectedNums[i];
}Example 1:
Input: nums = [1,1,2]
Output: 2, nums = [1,2,_]
Explanation: Sizning funktsiyangiz k = 2 ni qaytarishi kerak, sonlarning birinchi ikkita elementi mos ravishda 1 va 2 bo'ladi.
Qaytarilgan k dan keyin nima qoldirganingiz muhim emas (shuning uchun ular pastki chiziq).Example 2:
Cheklovlar:
Last updated
