일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 이진트리
- leetcode
- Python
- two pointers
- 미디움
- matrix
- 문자열
- binary search
- backtracking
- Array
- dfs
- 쉬움
- 리트코드
- recursive
- math
- Medium
- 재귀
- easy
- 중간
- linked list
- list
- string
- sorting
- DP
- binary tree
- HashTable
- hash table
- Binary
- tree
- Depth-first Search
- Today
- Total
목록2024/02 (31)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/binary-tree-level-order-traversal/ - LeetCode Can you solve this real interview question? - 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. 문제 설명 이진 트리의 각 레벨마다 노드 값을 모두 담은 리스트를 반환하는 것 예시) 아래 트리가 주어지면 [[3],[9,20],[15,7]]를 반환 3 / \ 9 20 / \ 15 7 3. 처음..
1. 문제 링크 https://leetcode.com/problems/add-digits/description/ 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. 문제 설명 정수 num이 주어졌을 때, 반복해서 각 자릿수를 더하여, 더한 값이 한자리가 될 때까지 반복하여, 해당 값을 반환 예시) num=38이라면, 3과 8을 더하면 11. 11은 두자리수이..
1. 문제 링크 https://leetcode.com/problems/validate-binary-search-tree/ Validate Binary Search Tree - LeetCode Can you solve this real interview question? Validate Binary Search Tree - Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: * The left subtree of a node contains only nodes with keys le leetcode.com 2. 문제 설명 주어진 tree가 이진..
데코레이터란? 파이썬에서 함수나 메소드를 감싸서 (Decorate하여), 특정 동작을 추가하거나 수정하는 기능을 말한다. 데코레이터를 사용하게 되면 코드의 재사용성을 높이고, 코드를 간결하게 유지하는 것이 가능하다. 데코레이터는 일반적으로 내부에 다른 함수를 정의하고, 그 함수를 반환하는 형태로 구현이 되는데, 이런 구조는 클로저(Closure)라 불리는 개념을 기반으로 한다. 아래의 예제를 보면, my_decorator라는 데코레이터 함수는 func이라는 인자를 받아, 그 함수를 감싸는 wrapper라는 함수를 정의하고, wrapper함수를 반환하고 있다. 이에 wrapper 함수는 클로저로써 외부함수(my_decorator)의 변수에 접근할 수 있다. @my_decorator와 같이 표시하면, 실제로..

1. 문제 링크 https://leetcode.com/problems/binary-tree-paths/description/ 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가 주어졌을 때, root부터 leaf까지 가는 모든 paths를 list에 append하여 반환 여기서 leaf란 children이 없는 n..
얕은 복사란? 원본 객체의 요소들을 새로운 객체로 복사하지만, 내부에 있는 객체들은 참조로 복사 내부 객체는 그래서 동일한 객체를 가리키게 됨 아래 예제를 보면 단순히 list를 copy한 후, 기존 리스트(original_list)를 변경하면, 얕은 복사를 한 shallow_copy도 값이 변하게 됨. "내부 객체가 동일한 객체 - 같은 주소"를 가리키고 있기 때문! original_list = [1, [2, 3], 4] shallow_copy = original_list.copy() # 얕은 복사 후 내부 리스트의 참조는 동일함 original_list[1][0] = 99 print(original_list) # 출력: [1, [99, 3], 4] print(shallow_copy) # 출력: [1,..
1. 문제 링크 Interleaving String - 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. 문제 설명 두 개의 문자열이 주어질 때, 두 문자열이 교차로 섞여서 주어진 문자열 목표 문자열을 형성할 수 있는지 판단하여 True, False를 반환하는 문제 예시) s1 = "aabcc", s2 = "dbbca", s3 = "aadb..
1. 문제 링크 https://leetcode.com/problems/valid-anagram/description/ 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. 문제 설명 문자열 s와 t가 주어졌을 때, 만약 t가 s의 Anagram이라면 True를 반환, 아니라면 False를 반환 여기서 Anagram이란, 일반적으로 모든 원래 문자를 정확히 한..