일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Medium
- 미디움
- Depth-first Search
- 문자열
- 리트코드
- hash table
- Binary
- 이진트리
- Array
- backtracking
- 쉬움
- linked list
- DP
- HashTable
- binary search
- easy
- string
- 중간
- dfs
- tree
- recursive
- sorting
- leetcode
- binary tree
- matrix
- Python
- 재귀
- math
- list
- two pointers
- Today
- Total
목록Algorithm/LeetCode (135)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/ransom-note/ Ransom Note - LeetCode Can you solve this real interview question? Ransom Note - Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. Each letter in magazine can only be used once in ranso leetcode.com 2. 문제 설명 두 문자열 ransomNote, magazine이 주어졌을 때 magazine의..
1. 문제 링크 LRU Cache - LeetCode LRU Cache - LeetCode Can you solve this real interview question? LRU Cache - Design a data structure that follows the constraints of a Least Recently Used (LRU) cache [https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU]. Implement the LRUCache class: * LRUCache(int c leetcode.com 2. 문제 설명 주어진 연산을 수행하는 LRU(Least Recently Used) 캐시를 구현하기 LRU 캐시가 지원해야하는 두 가지 연..
1. 문제 링크 https://leetcode.com/problems/reorder-list/ 2. 문제 설명 linked list의 head가 주어졌을 때, 해당 list를 아래처럼 표현할 수 있다. L0 → L1 → ... → Ln-1 → Ln 이 때, 아래의 형태가 되도록 list를 reorder해라. L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → ... 여기서 node의 value자체를 수정하는 것이 아니라, node의 연결관계를 바꿔야 한다. 예시1) head가 [1,2,3,4]로 1→2→3→4의 연결관계를 가지고 있다면, 1→4→2→3으로 변경할 수 있다. output = [1,4,2,3] 예시2) head가 [1,2,3,4,5]로 1→2→3→4→5의 연결관계를 가지고 있다면, ..
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/guess-number-higher-or-lower/ Guess Number Higher or Lower - LeetCode Can you solve this real interview question? Guess Number Higher or Lower - We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the leetcode.com 2. 문제 설명 1에서 부터 n까지 ..
1. 문제 링크 https://leetcode.com/problems/word-break/ Word Break - LeetCode Can you solve this real interview question? Word Break - Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may leetcode.com 2. 문제 설명 문자열과 사전(단어들이 들어 있는 리스트)이 주어졌을 때, 사전의 단어들을 조합하여..

1. 문제 링크 https://leetcode.com/problems/valid-perfect-square/description/ Valid Perfect Square - LeetCode Can you solve this real interview question? Valid Perfect Square - Given a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is the square of an integer. In other words, it is the product o leetcode.com 2. 문제 설명 양의 정수 num이 주어졌..
1. 문제 링크 https://leetcode.com/problems/copy-list-with-random-pointer/ Copy List with Random Pointer - LeetCode Can you solve this real interview question? Copy List with Random Pointer - A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy [https://en. leetcode.com 2. 문제 설명 연결 리스트가 ..