일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 재귀
- HashTable
- Array
- 문자열
- binary tree
- 쉬움
- 리트코드
- 중간
- 이진트리
- sorting
- backtracking
- Binary
- leetcode
- tree
- binary search
- dfs
- DP
- Python
- string
- Depth-first Search
- easy
- math
- linked list
- list
- matrix
- Medium
- recursive
- two pointers
- hash table
- 미디움
- Today
- Total
목록two pointers (10)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/linked-list-cycle-ii/description/ 2. 문제 설명 연결 리스트(Linked List)에서 순환(사이클)이 발생하는 경우, 순환의 시작 지점 노드를 반환하고, 사이클이 없으면 None 반환 3. 처음 풀이 노드를 한 칸씩 전진하며 set에 저장하고, 이미 들어있으면 그 노드를 반환. 끝까지 갈 동안 같은 노드가 나오지 않으면 사이클이 없으므로 return None 공간 복잡도 O(n)으로 좋지 않다. # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class..
1. 문제 링크 https://leetcode.com/problems/move-zeroes/description/ Move Zeroes - LeetCode Can you solve this real interview question? Move Zeroes - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 2. 문제 설명 정수로 구성된 array nums가 있을 때, 값이 0인 elements를 뒤로 옮기기. (그 외의 elements들은 상대적 순서를 유지해야 한다.) 여기서 ..
1. 문제 링크 https://leetcode.com/problems/palindrome-linked-list/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 2. 문제 설명 주어진 연결 리스트가 팰린드롬(좌우 뒤집어 같은 것)인지 확인하여 True 또는 False를 반환 3. 처음 풀이 head의 값을 리스트에 하나씩 추가한 후 그 리스트와 역순이 같으면 ..
1. 문제 링크 Summary Ranges - LeetCode LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 2. 문제 설명 정렬된 정수 배열이 주어졌을 때, 연속된 범위를 요약하여 문자열의 리스트로 반환하는 것 예시) [0,1,2,4,5,7]이 주어지면, 이 배열을 연속된 범위로 요약하면 ["0->2","4->5","7"] 3. 처음 풀이 two point..
1. 문제 링크 https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/ Partition List - LeetCode Can you solve this real interview question? Partition List - Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the no leetcode.com 2. 문제 설명 정렬된..
1. 문제 링크 LeetCode - The World's Leading Online Programming Learning Platform Next Permutation - LeetCode Can you solve this real interview question? Next Permutation - A permutation of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for arr = [1,2,3], the following are all the permutations of arr: [1,2,3], leetcode.com 2. 문제 설명 주어진 수를 한 번씩 사용..
1. 문제 링크 https://leetcode.com/problems/3sum/ 3Sum - LeetCode Can you solve this real interview question? 3Sum - Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain du leetcode.com 2. 문제 설명 주어진 리스트 nums와 서로 다른 인덱스 i, j, k에 대하여 nums[i]+nums[j]+nums[..
1. 문제 링크 LeetCode - The World's Leading Online Programming Learning Platform Container With Most Water - LeetCode Can you solve this real interview question? Container With Most Water - You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that toget leetcode.com 2. 문제 설명 리트 코드..