[LeetCode] Height Checker
목차 문제 heights를 정렬했을 때의 위치와 기존 위치가 같지 않은 개수를 구하는 문제입니다. 예시 Input: heights = [1,1,4,2,1,3] Output: 3 Explanation: heights: [1,1,4,2,1,3] expected: [1,1,1,2,3,4] Indices 2, 4, and 5 do not match. Input: heights = [5,1,2,3,4] Output: 5 Explanation: heights: [5,1,2,3,4] expected: [1,2,3,4,5] All indices do not match. Input: heights = [1,2,3,4,5] Output: 0 Explanation: heights: [1,2,3,4,5] expected: [..
2024. 4. 8.
[LeetCode] Remove Duplicates from Sorted Array
목차 문제 오름차순으로 정렬된 nums 배열에서 중복된 값들을 제외한 값들의 개수를 구하는 문제입니다. 예시 Input: nums = [1,1,2] Output: 2, nums = [1,2,_] Input: nums = [0,0,1,1,1,2,2,3,3,4] Output: 5, nums = [0,1,2,3,4,_,_,_,_,_] 제약사항 1
2024. 4. 8.