분류 전체보기
-
[LeetCode] 1413. Minimum Value to Get Positive Step by Step Sum알고리즘 문제 풀이 2021. 11. 12. 09:43
문제 출처: https://leetcode.com/problems/minimum-value-to-get-positive-step-by-step-sum/ Minimum Value to Get Positive Step by Step Sum - LeetCode 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 문제 정수 배열 nums가 주어지고, 초기 양의 값 startValue에서 시작한다. 각 반복에서, nums의 값을 startValue와 더하는 것을 단계적으로 수행한다(왼쪽에서 ..
-
[LeetCode] 441. Arranging Coins알고리즘 문제 풀이 2021. 11. 5. 10:39
문제 출처: https://leetcode.com/problems/arranging-coins/ Arranging Coins - LeetCode 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 문제 n개의 코인을 계단 형태로 쌓으려고 한다. 계단은 i번째 줄에는 정확히 i개의 코인이 있는 형태로 k 줄로 구성합니다. 마지막 줄의 경우 불완전한 형태일 수도 있습니다. n이 주어지면, 계단으로 쌓을 때 완전한 줄의 수를 반환하라. 예제 Input: n = 5 Output: 2 Exp..
-
[LeetCode] 404. Sum of Left Leaves카테고리 없음 2021. 11. 4. 22:33
문제 출처: https://leetcode.com/problems/sum-of-left-leaves/ Sum of Left Leaves - LeetCode 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 문제 이진트리의 root가 주어집니다. 왼쪽 리프 노드의 합을 반환하세요. 예제 Input: root = [3,9,20,null,null,15,7] Output: 24 Explanation: There are two left leaves in the binary tree, wit..
-
[LeetCode] 129. Sum Root to Leaf Numbers알고리즘 문제 풀이 2021. 11. 3. 12:35
문제 출처: https://leetcode.com/problems/sum-root-to-leaf-numbers/ Sum Root to Leaf Numbers - LeetCode 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 문제 0~9의 숫자를 포함하고 있는 이진 트리 root가 주어진다. 트리 안의 루트에서 말단까지의 경로가 숫자로 표현된다. 예를 들어, 루트에서 말단까지 경로가 1 -> 2 -> 3 이라면, 이는 숫자 123의 표현이다. 루트에서 말단까지 경로로 만들어지는 ..
-
[LeetCode] 980. Unique Paths Ⅲ알고리즘 문제 풀이 2021. 11. 2. 16:01
문제 출처: https://github.com/opwe37/Algorithm-Study/blob/master/LeetCode/src/980.js GitHub - opwe37/Algorithm-Study Contribute to opwe37/Algorithm-Study development by creating an account on GitHub. github.com 문제 m x n 크기의 정수 배열 grid가 주어집니다. grid[i][j]는 다음과 같은 의미를 갖습니다: 1 은 시작 사각형을 의미합니다. 정확히 한 개의 시작 지점을 갖습니다. 2 는 도착 사각형을 의미합니다. 정확히 한 개의 도착 지점을 갖습니다. 0 은 지나갈 수 있는 빈 사각형을 의미합니다. -1 은 지나갈 수 없는 장애물을 의미..
-
[LeetCode] 130. Surrounded Regions알고리즘 문제 풀이 2021. 11. 1. 11:40
문제 출처: https://leetcode.com/problems/surrounded-regions/ Surrounded Regions - LeetCode 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 문제 'X'와 'O'로 구성된 $m x n$ 행렬 'board'가 주어지면, 사면이 'X'로 둘러싸인 지역을 찾아라. 찾아진 지역의 모든 'O'를 'X'로 바꾸어라. 예제 Input: board = [["X","X","X","X"],["X","O","O","X"],["X","X"..
-
[LeetCode] 15. 3Sum알고리즘 문제 풀이 2021. 10. 29. 11:13
문제 출처: https://leetcode.com/problems/3sum/ 3Sum - LeetCode 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 문제 정수 배열 nums가 주어집니다. nums[i] + nums[j] + nums[k] == 0 이고, i != j, i !=k, 그리고 j != k 인 모든 [nums[i]m nums[j], nums[k]를 찾아라. 중복된 케이스는 답에 포함되어서는 안 된다. 예제 Input: nums = [-1,0,1,2,-1,-4] Ou..
-
[LeetCode] 75. Sort Colors알고리즘 문제 풀이 2021. 10. 27. 10:28
문제 출처: https://leetcode.com/problems/sort-colors/ Sort Colors - LeetCode 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 문제 빨강, 하양 그리고 파란색으로 칠해진 n개의 객체 배열 nums가 주어진다. 같은 색이 인접하도록 내부 정렬하여라. 빨강, 하양 그리고 파랑을 정수 0, 1 그리고 2로 대체한다. 문제를 풀 때 내부 라이브러리의 정렬을 사용하지 마라. 예제 Input: nums = [2,0,2,1,1,0] Outp..