"20가지 필수 알고리즘을 통해 코딩 인터뷰 프로가 되기" 2편입니다. 이 시리즈는 3편까지 이어집니다.
당신이 알아야 할 20가지 코딩 알고리즘 (1) - [https://careerly.co.kr/comments/75731]
당신이 알아야 할 20가지 코딩 알고리즘 (3) - [https://careerly.co.kr/comments/76617]
1️⃣ Breadth First Search(BFS)
- 사용: 너비 우선 탐색으로 그래프나 트리를 탐색할 때
- 자료구조: Tree, Graph, Matrix, Queue
- 예시 문제:
[https://leetcode.com/problems/binary-tree-level-order-traversal/]
[https://leetcode.com/problems/minimum-depth-of-binary-tree/]
2️⃣ Depth First Search(DFS)
- 사용: 깊이 우선 탐색으로 그래프나 트리를 탐색할 때
- 자료구조: Tree, Graph, Matrix
- 예시 문제:
[https://leetcode.com/problems/path-sum-ii/]
3️⃣ Two Heaps
- 사용: 가장 작은 원소를 찾기 위한 최소 힙, 가장 큰 원소를 찾기 위한 최대 힙을 사용할 때
- 자료구조: Heap, Array
- 예시 문제:
[https://leetcode.com/problems/find-median-from-data-stream/]
4️⃣ Subsets
- 사용: 순열 또는 조합을 처리할 때
- 자료구조: Queue, Array, String
- 예시 문제:
[https://leetcode.com/problems/letter-case-permutation/]
[https://leetcode.com/problems/generalized-abbreviation/]
5️⃣ Modified Binary Search
- 사용: 정렬된 집합을 효율적으로 검색할 때
- 자료구조: Array
- 예시 문제:
[https://leetcode.com/problems/peak-index-in-a-mountain-array/]
6️⃣ Bitwise XOR
- 사용: XOR 연산자를 사용해 비트를 조작할 때
- 자료구조: Array, Bits
- 예시 문제:
[https://leetcode.com/problems/single-number-ii/]
[https://leetcode.com/problems/flipping-an-image/]
7️⃣ Top 'K' Elements
- 사용: 가장 작은/큰/자주 발생하는 'K'번째 원소를 찾을 때
- 자료구조: Array, Heap, Queue
- 예시 문제:
[https://leetcode.com/problems/k-closest-points-to-origin/]