LeetCodeRemove Duplicates from Sorted Array IIRemove Duplicates from Sorted Array IIMediumArrayTwo PointersSolution export function removeDuplicates(nums: number[]): number { let currentIndex = 0; for (const num of nums) { if (currentIndex < 2 || nums[currentIndex - 2] < num) { nums[currentIndex] = num; currentIndex += 1; } } return currentIndex; }LeetCodeRemove Duplicates from Sorted Array IIhttps://leetcode.com/problems/remove-duplicates-from-sorted-array-ii