목록2024/04 (28)
넘치게 채우기
https://leetcode.com/problems/number-of-wonderful-substrings/description/leetcode - Number of Wonderful Substrings문제 유형 : 비트마스킹, 비트 조작문제 난이도 : Medium 문제A wonderful string is a string where at most one letter appears an odd number of times.For example, "ccjjc" and "abab" are wonderful, but "ab" is not.Given a string word that consists of the first ten lowercase English letters ('a' through 'j'),..
https://leetcode.com/problems/minimum-number-of-operations-to-make-array-xor-equal-to-k/description/leetcode - Minimum Number of Operations to Make Array XOR Equal to K문제 유형 : 비트마스킹, 비트 조작문제 난이도 : Medium 문제You are given a 0-indexed integer array nums and a positive integer k.You can apply the following operation on the array any number of times:Choose any element of the array and flip a bit in i..
https://leetcode.com/problems/sum-of-distances-in-tree/description/leetcode - Sum of Distances in Tree문제 유형 : dfs, 재귀, 트리, 다이나믹 프로그래밍문제 난이도 : Hard 문제There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges.You are given the integer n and the array edges where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree.Return an array ..
https://leetcode.com/problems/freedom-trail/description/leetcode - Freedom Trail문제 유형 : 재귀 / dfs / 다이나믹 프로그래밍문제 난이도 : Hard 문제In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring" and use the dial to spell a specific keyword to open the door.Given a string ring that represents the code engraved on the outer ring and another..
https://leetcode.com/problems/minimum-falling-path-sum-ii/description/Leetcode - Minimum Falling Path Sum II문제 유형 : 다이나믹 프로그래밍문제 난이도 : Hard 문제Given an n x n integer matrix grid, return the minimum sum of a falling path with non-zero shifts.A falling path with non-zero shifts is a choice of exactly one element from each row of grid such that no two elements chosen in adjacent rows are in the same..
https://leetcode.com/problems/longest-ideal-subsequence/description/Leetcode - Longest Ideal Subsequence문제 유형 : 다이나믹 프로그래밍, 문자열처리문제 난이도 : Medium 문제You are given a string s consisting of lowercase letters and an integer k. We call a string t ideal if the following conditions are satisfied:t is a subsequence of the string s.The absolute difference in the alphabet order of every two adjacent letter..
https://leetcode.com/problems/minimum-height-trees/description/ Leetcode - Minimum Height Trees 문제 유형 : bfs / 위상 정렬 문제 난이도 : Medium 문제 A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree. Given a tree of n nodes labelled from 0 to n - 1, and an array of n - 1 edges where edges[i] = [ai, bi]..
https://leetcode.com/problems/open-the-lock/description/ Leetcode - Open the Lock 문제 유형 : dfs/bfs, 문자열 처리 문제 난이도 : Medium 문제 You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel..
https://leetcode.com/problems/find-if-path-exists-in-graph/description/ Leetcode - Find if Path Exists in Graph 문제 유형 : 그래프, dfs / bfs 문제 난이도 : Easy There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, where each edges[i] = [ui, vi] denotes a bi-directional edge between verte..
https://leetcode.com/problems/find-all-groups-of-farmland/description/ Leetcode - Find All Groups of Farmland 문제 유형 : dfs/bfs, 행렬 문제 난이도 : Medium 문제 You are given a 0-indexed m x n binary matrix land where a 0 represents a hectare of forested land and a 1 represents a hectare of farmland. To keep the land organized, there are designated rectangular areas of hectares that consist entirely of farm..