목록LeetCode (568)
넘치게 채우기
https://leetcode.com/problems/minimum-cost-for-tickets/description/leetcode - Minimum Cost For Tickets문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365.Train tickets are sold in three different ways:a 1-day pass is sold for costs[0] dol..
https://leetcode.com/problems/number-of-ways-to-form-a-target-string-given-a-dictionary/description/leetcode - Number of Ways to Form a Target String Given a Dictionary문제 유형: 다이나믹 프로그래밍, 문자열 처리문제 난이도: Hard 문제You are given a list of strings of the same length words and a string target.Your task is to form target using the given words under the following rules:target should be formed from left to ..
https://leetcode.com/problems/maximum-sum-of-3-non-overlapping-subarrays/description/leetcode - Maximum Sum of 3 Non-Overlapping Subarrays문제 유형: 슬라이딩 윈도우, 부분합, 다이나믹 프로그래밍문제 난이도: Hard 문제Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them.Return the result as a list of indices representing the starting position of each int..
https://leetcode.com/problems/best-sightseeing-pair/description/leetcode - Best Sightseeing Pair문제 유형: 그리디, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them.The score of a pair (i values[i] + values[j] + i - j: the sum of the values of the sightseein..
https://leetcode.com/problems/target-sum/leetcode - Target Sum문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate ..
https://leetcode.com/problems/find-minimum-diameter-after-merging-two-trees/description/leetcode - Find Minimum Diameter After Merging Two Trees문제 유형: 트리, bfs, 그리디문제 난이도: Hard 문제There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You are given two 2D integer arrays edges1 and edges2 of lengths n - 1 and m - 1, respectively, where edges..
https://leetcode.com/problems/minimum-number-of-operations-to-sort-a-binary-tree-by-level/description/leetcode - Minimum Number of Operations to Sort a Binary Tree by Level문제 유형: 정렬, 트리, bfs문제 난이도: Medium 문제You are given the root of a binary tree with unique values.In one operation, you can choose any two nodes at the same level and swap their values.Return the minimum number of operations neede..
https://leetcode.com/problems/find-building-where-alice-and-bob-can-meet/description/leetcode - Find Building Where Alice and Bob Can Meet문제 유형: 이진 탐색, 모노토닉 스택문제 난이도: Hard 문제You are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the ith building.If a person is in building i, they can move to any other building j if and only if i and heights[i] Yo..
https://leetcode.com/problems/maximum-number-of-k-divisible-components/description/leetcode - Maximum Number of K-Divisible Components문제 유형: 트리, dfs, 부분합문제 난이도: Hard 문제There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the t..
https://leetcode.com/problems/reverse-odd-levels-of-binary-tree/description/leetcode - Reverse Odd Levels of Binary Tree문제 유형: 이진트리, bfs문제 난이도: Medium 문제Given the root of a perfect binary tree, reverse the node values at each odd level of the tree.For example, suppose the node values at level 3 are [2,1,3,4,7,11,29,18], then it should become [18,29,11,7,4,3,1,2].Return the root of the reversed t..