목록LeetCode (548)
넘치게 채우기
https://leetcode.com/problems/apply-operations-to-maximize-score/description/leetcode - Apply Operations to Maximize Score문제 유형: 모노토닉 스택, 스택, 그리디, 정수론, 정렬문제 난이도: Hard 문제You are given an array nums of n positive integers and an integer k.Initially, you start with a score of 1. You have to maximize your score by applying the following operation at most k times:Choose any non-empty subarray nums[l,..
https://leetcode.com/problems/maximum-number-of-points-from-grid-queries/description/leetcode - Maximum Number of Points From Grid Queries문제 유형: 우선순위 큐, bfs, 그리디문제 난이도: Hard 원래 LeetCode문제를 leetcode solution탭에만 올리고 티스토리에 더 이상 안올리려 했는데..앞으로 인상깊은 문제만 올리려합니다 문제 You are given an m x n integer matrix grid and an array queries of size k.Find an array answer of size k such that for each integer queries[..
https://riveroverflow.hashnode.dev/series/dsa-and-cp
https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/description/leetcode - Construct Binary Tree from Preorder and Postorder Traversal문제 유형: 트리, 분할 정복문제 난이도: Medium 문제Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstr..
https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/description/leetcode - Recover a Tree From Preorder Traversal문제 유형: 스택, 트리, dfs, 문자열 처리문제 난이도: Hard 문제We run a preorder depth-first search (DFS) on the root of a binary tree.At each node in this traversal, we output D dashes (where D is the depth of this node), then we output the value of this node. If the depth of a node is D..
https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/description/?envType=daily-question&envId=2025-02-21leetcode - Find Elements in a Contaminated Binary Tree문제 유형: 트리, 해시문제 난이도: Medium 문제Given a binary tree with the following rules:root.val == 0For any treeNode:If treeNode.val has a value x and treeNode.left != null, then treeNode.left.val == 2 * x + 1If treeNode.val has a..
https://leetcode.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/description/leetcode - The k-th Lexicographical String of All Happy Strings of Length n문제 유형: 백트래킹, 수학, 조합론, 해 구성하기문제 난이도: Medium 문제A happy string is a string that:consists only of letters of the set ['a', 'b', 'c'].s[i] != s[i + 1] for all values of i from 1 to s.length - 1 (string is 1-indexed).For e..
https://leetcode.com/problems/construct-smallest-number-from-di-string/description/leetcode - Construct Smallest Number From DI String문제 유형: 백트래킹, 비트마스킹, 문자열 처리, 그리디문제 난이도: Medium 문제You are given a 0-indexed string pattern of length n consisting of the characters 'I' meaning increasing and 'D' meaning decreasing.A 0-indexed string num of length n + 1 is created using the following conditions:num..
https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence/description/leetcode - Construct the Lexicographically Largest Valid Sequence문제 유형: dfs, 재귀, 백트래킹, 비트마스킹문제 난이도: Medium 문제Given an integer n, find a sequence that satisfies all of the following:The integer 1 occurs once in the sequence.Each integer between 2 and n occurs twice in the sequence.For every integer i ..
https://leetcode.com/problems/find-the-punishment-number-of-an-integer/leetcode - FInd the Punishment Number of an Integer문제 유형: 백트래킹문제 난이도: Medium 문제Given a positive integer n, return the punishment number of n.The punishment number of n is defined as the sum of the squares of all integers i such that:1 The decimal representation of i * i can be partitioned into contiguous substrings such that ..