목록LeetCode (522)
넘치게 채우기
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..
https://leetcode.com/problems/max-chunks-to-make-sorted/description/leetcode - Max Chunks To Make Sorted문제 유형: 그리디, 브루트 포스문제 난이도: Medium 문제You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1].We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equa..
https://leetcode.com/problems/final-prices-with-a-special-discount-in-a-shop/description/leetcode - Final Prices With a Special Discount in a Shop문제 유형: 구현문제 난이도: Easy 문제You are given an integer array prices where prices[i] is the price of the ith item in a shop.There is a special discount for items in the shop. If you buy the ith item, then you will receive a discount equivalent to prices[j] wh..
https://leetcode.com/problems/construct-string-with-repeat-limit/description/leetcode - Construct String With Repeat Limit문제 유형: 우선순위 큐, 그리디, 문자열 처리문제 난이도: Medium 문제You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s...
https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/description/leetcode - Final Array State After K Multiplication Operations I문제 유형: 구현, 그리디문제 난이도: Easy 문제You are given an integer array nums, an integer k, and an integer multiplier.You need to perform k operations on nums. In each operation:Find the minimum value x in nums. If there are multiple occurrences of t..
https://leetcode.com/problems/maximum-average-pass-ratio/description/leetcode - Maximum Average Pass Ratio문제 유형: 우선순위 큐, 그리디문제 난이도: Medium 문제There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passi, totali]. You know beforehand that in the ith class, there are totali total students, but only pas..
https://leetcode.com/problems/continuous-subarrays/description/leetcode - Continuous Subarrays문제 유형: 슬라이딩 윈도우, 모노토닉 스택, 모노토닉 큐, 모노토닉 데크문제 난이도: Medium 문제You are given a 0-indexed integer array nums. A subarray of nums is called continuous if:Let i, i + 1, ..., j be the indices in the subarray. Then, for each pair of indices i 0 Return the total number of continuous subarrays.A subarray is a cont..