일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- binary search
- DP
- two pointers
- matrix
- 리트코드
- easy
- tree
- Binary
- dfs
- Python
- 쉬움
- sorting
- 문자열
- string
- Array
- recursive
- 중간
- hash table
- linked list
- Medium
- leetcode
- 이진트리
- list
- backtracking
- math
- binary tree
- HashTable
- 재귀
- Depth-first Search
- 미디움
- Today
- Total
목록twopointer (4)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ Remove Duplicates from Sorted Array II - LeetCode Can you solve this real interview question? Remove Duplicates from Sorted Array II - Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place [https://en.wikipedia.org/wiki/In-place_algorithm] such that each unique elemen leetcode.com..
1. 문제 링크 https://leetcode.com/problems/happy-number/ Happy Number - LeetCode Can you solve this real interview question? Happy Number - Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: * Starting with any positive integer, replace the number by the sum of the squar leetcode.com 2. 문제 설명 주어진 수가 happy 넘버인지 따져서 True, False 반환 여기서 h..
1. 문제 링크 https://leetcode.com/problems/4sum/description/ 4Sum - LeetCode Can you solve this real interview question? 4Sum - Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: * 0 List[List[int]]: nums.sort() output = [] for i in range(len(nums)-3): if i > 0 and nums[i] == nums[i - 1]: continue # 중복된 값을 건너뛰기 for j in ra..
1. 문제 링크 https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 2. 문제 설명 이번엔 좋아요(13K)보다 싫어요(17.2K)가 더 많지만 그럼에도 상위에 있는 문제 오름차순으로 sort된 nums라는 배열이 있을 때, 중복이 없도록 array를 쌓고, unique 배열의 가장 마지막 index를 반환. 간단해보이지만, 전제조건이 "in-place"로, 기존의 데이터 구조를 변경하지 않고 정렬 또는 변환 작업을 수행해야 함 예시1) nums = [1,1,2] 일 때, nums = [1,2,_]로 변환하고, 2의 index인 1를 반환 예시2) nums = [0,0,1,1,1,2,2,2,3,3,4] 일 때, nums = [0,1,2,3..