리트코드 [leetcode #994 Rotting Oranges] You are given an m x n grid where each cell can have one of three values: Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must ... 알고리즘리트코드leetcodealgorithmalgorithm [leetcode #952] Largest Component Size by Common Factor You are given an integer array of unique positive integers nums. Consider the following graph: There are nums.length nodes, labeled nums[0] to nums[nums.length - 1], There is an undirected edge between nums[i] and nums[j... leetcode리트코드알고리즘algorithmalgorithm [리트코드] 1011 - javascript ✔ 알고리즘 : 이분탐색 ✔ arr에는 각 박스의 무게가 들어가있는 배열이다. 컨베이어 벨트의 모든 포장이 k일 이내에 발송될 수 있도록 선박의 최소 중량 용량을 반환해야 하는 문제이다. ✔ 전형적인 이분탐색 문제로 left를 1 right를 무게의 합으로 설정하고 시작하였다. ✔ left와 right의 중앙을 mid로 설정하고 arr[0]부터 탐색을 시작한다. ✔ mid가 될때까지 계속 합... 리트코드algorithmalgorithm [leetcode #441] Arranging Coins You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return th... leetcode리트코드알고리즘algorithmalgorithm [LeetCode] 2.add two number 리트코드 코딩 테스트 준비 문제에 대한 자세한 설명은 다음 사이트에서 확인 할 수 있다. ❓ 문제 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single di... python리트코드코딩테스트python [dfs] 113번 Path Sum II Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node r... JavaScript리트코드leetcode자바스크립트JavaScript [leetcode #633] Sum of Square Numbers Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: Example 3: Example 4: Example 5: Constraints: 주어진 수 c가 임의의 두 수를 각각 제곱한 값의 합이 되는지 확인하는 문제다. 번뜩이는 아이... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1008] Construct Binary Search Tree from Preorder Traversal Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root. It is guaranteed that there is always possible to find a binary se... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1217] Minimum Cost to Move Chips to The Same Position We have n chips, where the position of the ith chip is position[i]. We need to move all the chips to the same position. In one step, we can change the position of the ith chip from position[i] to: Return the minimum cost... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1632] Rank Transform of a Matrix Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank of matrix[0][0] is 1 because it is the smallest integer in its row and column. row와 column의 랭크를 각각의 dp에 저... algorithm알고리즘leetcode리트코드matrixalgorithm [leetcode #154] Find Minimum in Rotated Sorted Array II Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time re... algorithm알고리즘leetcode리트코드algorithm [leetcode #1235] Maximum Profit in Job Scheduling We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime, endTime and profit arrays, return the maximum profit you can take such... algorithmleetcode알고리즘dynamic programming리트코드DPDP [코딩테스트, LeetCode] 문제풀이 #35, #53, #217, #278 Search Insert Position sorting된 int array와 target이 주어지면 target의 인덱스, 혹은 있어야 할 자리를 반환하는 문제이다. while(start<end)를 하면 Wrong Answer가 뜨는데, 이 문제의 경우 target이 array에 속하지 않을 가능성도 있기 때문에 <=로 하여야 한다. mid를 (start + end)/2 가 아닌 start ... 알고리즘리트코드리트코드 항해99, 4주차 구간병합 항해 99, 알고리즘 3주차 교재 : 파이썬 알고리즘 인터뷰 / 이것이 코딩테스트다(동빈좌) 병합/퀵정렬(Sort) 퀵정렬 퀵 정렬(quick sort) 알고리즘의 구체적인 개념 하나의 리스트를 피벗(pivot)을 기준으로 두 개의 비균등한 크기로 분할하고 분할된 부분 리스트를 정렬한 다음, 두 개의 정렬된 부분 리스트를 합하여 전체가 정렬된 리스트가 되게 하는 방법이다. 분할(Divide)... 알고리즘병합정렬리트코드머지소트정렬리트코드 [leetcode #330] Patching Array nums로 주어진 값을 순차적으로 탐색하면서 없는 값을 계산하는데, 없는 값이 탐색하고 있는 nums의 값보다 작거나 같을 경우 patch하는 값이 된다. miss = 1, nums[0] = 1 → nums[0] ≦ 1 next miss → nums[0] + miss = 2 nums[0] → nums[1] 다음 탐색할 대상은 miss + nums[0]인 2가 된다. miss = 2, nums... 알고리즘leetcodealgorithm리트코드algorithm
[leetcode #994 Rotting Oranges] You are given an m x n grid where each cell can have one of three values: Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must ... 알고리즘리트코드leetcodealgorithmalgorithm [leetcode #952] Largest Component Size by Common Factor You are given an integer array of unique positive integers nums. Consider the following graph: There are nums.length nodes, labeled nums[0] to nums[nums.length - 1], There is an undirected edge between nums[i] and nums[j... leetcode리트코드알고리즘algorithmalgorithm [리트코드] 1011 - javascript ✔ 알고리즘 : 이분탐색 ✔ arr에는 각 박스의 무게가 들어가있는 배열이다. 컨베이어 벨트의 모든 포장이 k일 이내에 발송될 수 있도록 선박의 최소 중량 용량을 반환해야 하는 문제이다. ✔ 전형적인 이분탐색 문제로 left를 1 right를 무게의 합으로 설정하고 시작하였다. ✔ left와 right의 중앙을 mid로 설정하고 arr[0]부터 탐색을 시작한다. ✔ mid가 될때까지 계속 합... 리트코드algorithmalgorithm [leetcode #441] Arranging Coins You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return th... leetcode리트코드알고리즘algorithmalgorithm [LeetCode] 2.add two number 리트코드 코딩 테스트 준비 문제에 대한 자세한 설명은 다음 사이트에서 확인 할 수 있다. ❓ 문제 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single di... python리트코드코딩테스트python [dfs] 113번 Path Sum II Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. Each path should be returned as a list of the node values, not node r... JavaScript리트코드leetcode자바스크립트JavaScript [leetcode #633] Sum of Square Numbers Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: Example 3: Example 4: Example 5: Constraints: 주어진 수 c가 임의의 두 수를 각각 제곱한 값의 합이 되는지 확인하는 문제다. 번뜩이는 아이... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1008] Construct Binary Search Tree from Preorder Traversal Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its root. It is guaranteed that there is always possible to find a binary se... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1217] Minimum Cost to Move Chips to The Same Position We have n chips, where the position of the ith chip is position[i]. We need to move all the chips to the same position. In one step, we can change the position of the ith chip from position[i] to: Return the minimum cost... leetcode리트코드알고리즘algorithmalgorithm [leetcode #1632] Rank Transform of a Matrix Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank of matrix[0][0] is 1 because it is the smallest integer in its row and column. row와 column의 랭크를 각각의 dp에 저... algorithm알고리즘leetcode리트코드matrixalgorithm [leetcode #154] Find Minimum in Rotated Sorted Array II Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time re... algorithm알고리즘leetcode리트코드algorithm [leetcode #1235] Maximum Profit in Job Scheduling We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime, endTime and profit arrays, return the maximum profit you can take such... algorithmleetcode알고리즘dynamic programming리트코드DPDP [코딩테스트, LeetCode] 문제풀이 #35, #53, #217, #278 Search Insert Position sorting된 int array와 target이 주어지면 target의 인덱스, 혹은 있어야 할 자리를 반환하는 문제이다. while(start<end)를 하면 Wrong Answer가 뜨는데, 이 문제의 경우 target이 array에 속하지 않을 가능성도 있기 때문에 <=로 하여야 한다. mid를 (start + end)/2 가 아닌 start ... 알고리즘리트코드리트코드 항해99, 4주차 구간병합 항해 99, 알고리즘 3주차 교재 : 파이썬 알고리즘 인터뷰 / 이것이 코딩테스트다(동빈좌) 병합/퀵정렬(Sort) 퀵정렬 퀵 정렬(quick sort) 알고리즘의 구체적인 개념 하나의 리스트를 피벗(pivot)을 기준으로 두 개의 비균등한 크기로 분할하고 분할된 부분 리스트를 정렬한 다음, 두 개의 정렬된 부분 리스트를 합하여 전체가 정렬된 리스트가 되게 하는 방법이다. 분할(Divide)... 알고리즘병합정렬리트코드머지소트정렬리트코드 [leetcode #330] Patching Array nums로 주어진 값을 순차적으로 탐색하면서 없는 값을 계산하는데, 없는 값이 탐색하고 있는 nums의 값보다 작거나 같을 경우 patch하는 값이 된다. miss = 1, nums[0] = 1 → nums[0] ≦ 1 next miss → nums[0] + miss = 2 nums[0] → nums[1] 다음 탐색할 대상은 miss + nums[0]인 2가 된다. miss = 2, nums... 알고리즘leetcodealgorithm리트코드algorithm