
[LeetCode] Remove Duplicates from Sorted Array II - TypeScript 문제 풀이 및 개선 과정문제 설명LeetCode의 "Remove Duplicates from Sorted Array II" 문제는 정렬된 배열에서 각 원소가 최대 2번까지만 포함되도록 중복을 제거하는 문제입니다.배열을 직접 수정해야 하며, 중복을 제거한 후에도 배열 크기는 유지되어야 합니다. 반환값으로 유효한 배열 길이를 제공합니다.처음 풀이먼저, 문제를 해결하기 위해 다음과 같은 코드를 작성했습니다.export function removeDuplicates(nums: number[]): number { let current = 1; for (let index = 2; index 초기 코드..