일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- easy
- hash table
- 리트코드
- Depth-first Search
- dfs
- Binary
- linked list
- leetcode
- Medium
- list
- binary tree
- matrix
- 이진트리
- Array
- 미디움
- HashTable
- binary search
- math
- tree
- 문자열
- 중간
- DP
- sorting
- 재귀
- two pointers
- string
- backtracking
- recursive
- 쉬움
- Python
- Today
- Total
목록easy (39)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/power-of-two/description/ 2. 문제 설명 정수 n이 주어졌을 때, 만약 해당 수가 2의 거듭제곱이면 True를 아니면 False를 반환 예시1) n=1일 때, 1은 2의 0 거듭제곱이므로 True 반환 예시2) n=16일 때, 16은 2의 4 거듭제곱이므로 True 반환 예시3) n=3일 때, 3은 2의 거듭제곱이 아니므로 False를 반환 3. 처음 풀이 Follow up에서 loops나 recursion을 쓰지 않고, 풀 수 있는지를 물어봐서 다른 방법을 생각해보다가, 10진법을 2진법으로 바꾸었을 때, 2의 거듭제곱이라면 10000, 100, 10 등의 형태일 것이기 때문에, 1을 제외한 값을 int로 변환했..

1. 문제 링크 https://leetcode.com/problems/invert-binary-tree/ 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. 문제 설명 binary tree의 root가 주어졌을 때, 이를 invert한 root를 반환 예시) input이 [4,2,7,1,3,6,9] 이면 output이 [4,7,2,9,6,3,1]로 각 노드의..
1. 문제 링크 https://leetcode.com/problems/contains-duplicate-ii/description/ Contains Duplicate II - LeetCode Can you solve this real interview question? Contains Duplicate II - Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) k: window.remove(nums[i - k]) return False
1. 문제 링크 https://leetcode.com/problems/contains-duplicate/ Contains Duplicate - LeetCode Can you solve this real interview question? Contains Duplicate - Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: Input: nums = [1,2,3,1] Output: true Ex leetcode.com 2. 문제 설명 오랜만에 쉬어갈 겸 easy 문제를 풀었다. integer로..
1. 문제 링크 https://leetcode.com/problems/reverse-linked-list/description/ Reverse Linked List - LeetCode Can you solve this real interview question? Reverse Linked List - Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: [https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg] Input: head = [1,2,3,4,5] O leetcode.com 2. 문제 설명 linked list인 head가 ..
1. 문제 링크 https://leetcode.com/problems/isomorphic-strings/ Isomorphic Strings - LeetCode Can you solve this real interview question? Isomorphic Strings - Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replace leetcode.com 2. 문제 설명 두 문자열 s와 t가 주어졌을 때, 두 문자열이 iso..
1. 문제 링크 https://leetcode.com/problems/remove-linked-list-elements/ Remove Linked List Elements - LeetCode Can you solve this real interview question? Remove Linked List Elements - Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 1: [https://assets.leetcode. leetcode.com 2. 문제 설명 연결 리스트 head와 va..
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..