목록LeetCode (521)
넘치게 채우기
https://leetcode.com/problems/make-lexicographically-smallest-array-by-swapping-elements/description/leetcode - Make Lexicographically Smallest Array by Swapping Elements문제 유형: 우선순위큐, 유니온-파인드문제 난이도: Medium 문제You are given a 0-indexed array of positive integers nums and a positive integer limit.In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - num..
https://leetcode.com/problems/find-eventual-safe-states/description/leetcode - Find Eventual Safe States문제 유형: dfs, 위상 정렬문제 난이도: Medium 문제There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where graph[i] is an integer array of nodes adjacent to node i, meaning there is an edge from node i to each node in gra..
https://leetcode.com/problems/count-servers-that-communicate/description/leetcode - Count Servers that Communicate문제 유형: 행렬문제 난이도: Medium 문제You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.Retu..
https://leetcode.com/problems/map-of-highest-peak/description/leetcode - Map of Highest Peak문제 유형: bfs, 행렬문제 난이도: Medium 문제You are given an integer matrix isWater of size m x n that represents a map of land and water cells.If isWater[i][j] == 0, cell (i, j) is a land cell.If isWater[i][j] == 1, cell (i, j) is a water cell.You must assign each cell a height in a way that follows these rules:The h..
https://leetcode.com/problems/grid-game/description/leetcode - Grid Game문제 유형: 부분합, 구간합, 그리디문제 난이도: Medium 문제You are given a 0-indexed 2D array grid of size 2 x n, where grid[r][c] represents the number of points at position (r, c) on the matrix. Two robots are playing a game on this matrix.Both robots initially start at (0, 0) and want to reach (1, n-1). Each robot may only move to the right ((..
https://leetcode.com/problems/first-completely-painted-row-or-column/description/leetcode - First Completely Painted Row or Column문제 유형: 행렬, 구현, 시뮬레이션문제 난이도: Medium 문제You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n].Go through each index i in arr starting from index 0 and paint the cell in mat containi..
https://leetcode.com/problems/trapping-rain-water-ii/description/leetcode - Trapping Rain Water II문제 유형: 우선순위 큐, bfs문제 난이도: Hard 문제Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. m x n의 정수 행렬 heightMap이 주어진다. 이는 2D의 높이 지도를 셀단위로 나타내는데, 비가 오고 난 뒤 물이 고이는 물의 총 양을 구하여라. 풀이처음에는 https://rivero..
https://leetcode.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid/description/leetcode - Minimum Cost to Make at Least One Valid Path in a Grid문제 유형: 최단 경로, 다익스트라문제 난이도: Hard 문제Given an m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j] can be:1 which means go to the cell to the righ..
https://leetcode.com/problems/neighboring-bitwise-xor/description/leetcode - Neighboring Bitwise XOR문제 유형: 비트마스킹, 그리디문제 난이도: Medium 문제A 0-indexed array derived with length n is derived by computing the bitwise XOR (⊕) of adjacent values in a binary array original of length n.Specifically, for each index i in the range [0, n - 1]:If i = n - 1, then derived[i] = original[i] ⊕ original[0].Otherwise..
https://leetcode.com/problems/bitwise-xor-of-all-pairings/description/leetcode - Bitwise XOR of All Pairings문제 유형: 비트마스킹문제 난이도: Medium 문제You are given two 0-indexed arrays, nums1 and nums2, consisting of non-negative integers. There exists another array, nums3, which contains the bitwise XOR of all pairings of integers between nums1 and nums2 (every integer in nums1 is paired with every integer ..