일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- backtracking
- math
- matrix
- sorting
- 리트코드
- two pointers
- HashTable
- binary tree
- linked list
- Medium
- leetcode
- Array
- dfs
- easy
- 이진트리
- 미디움
- string
- list
- recursive
- 중간
- hash table
- Binary
- DP
- 재귀
- Depth-first Search
- tree
- Python
- 쉬움
- 문자열
- Today
- Total
목록Algorithm/LeetCode (135)
부부의 코딩 성장 일기
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/letter-combinations-of-a-phone-number/ Letter Combinations of a Phone Number - LeetCode Can you solve this real interview question? Letter Combinations of a Phone Number - Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of d leetcode.com 2..
1. 문제 링크 https://leetcode.com/problems/3sum-closest/ 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. 문제 설명 리스트 nums와 target 수가 주어졌을 때 nums에서 서로 다른 세 개를 더하여 만들 수 있는 값 중 target과 가장 가까운 값을 반환 예시) nums = [-1,2,1,-4], target..
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. 문제 링크 https://leetcode.com/problems/integer-to-roman/submissions/ 2. 문제 설명 우리가 쓰는 정수가 주어지면 Roman 숫자로 바꾸어 return 하는 문제 아래의 기호를 이용함 I: 1 V: 5 X: 10 L: 50 L: 100 D: 500 M: 1000 이 때, I는 V,X 앞에 쓰여서 4,9를 나타냄 X는 L,C 앞에 쓰여서 40,90을 나타냄 C는 D,M 앞에 쓰여서 400,900을 나타냄 예시) 3 → III, 58 → LVIII, 1994 → MCMXCIV 3. 처음 풀이 딱히 특별한 알고리즘이 없을 것 같아서, 정수에 매칭되는 로마 문자에 대한 dictionary를 만들어두고, num 이 특정 숫자 이상이면, 그 숫자에 대한 로마 문..
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. 문제 설명 리트 코드..
1. 문제 링크 https://leetcode.com/problems/string-to-integer-atoi/ 2. 문제 설명 주어진 문자열을 숫자로 바꾸는 것 규칙 처음 나오는 공백 ''은 무시 그러다가 처음에 부호('+', '-')가 나오면 이를 최종 결과에 반영 그 외 수가 아닌 문자가 나오면 멈춤 (기본값은 0, 그 전에 수가 나와서 반영되었다면 그 값) 수가 나오기 시작했으면 그 이후에 수가 아닌 것이 나오면 멈춤 마지막으로 32bit 넘어가면, 내리거나(너무 큰 수), 올려서(너무 작은 수) 반환 예시1) "42" → 42 예시2) " -42" → -42 (공백 무시) 예시3) "4193 with words" → 4193 (수 뒤에 수 아닌 것 나오면 stop) 예시4) "-1123u3761..
1. 문제 링크 https://leetcode.com/problems/reverse-integer/ Reverse Integer - LeetCode Can you solve this real interview question? Reverse Integer - Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the envir leetcode.com 2. 문제 설명 부호가 있는 32bit 정수가 주어졌을 때, 앞뒤 순서를 바꾸어 ..