[LeetCode] 1861. Rotating the Box You are given an m x n matrix of characters box representing a side-view of a box. Each cell of the box is one of the following:A stone ‘#’A stationary obstacle ‘*’Empty ‘.’ The box is rotated 90 degr 2024-11-24 #leetcode #array #two pointer #java #matrix
[LeetCode] 3238. Find the Number of Winning Players You are given an integer n representing the number of players in a game and a 2D array pick where pick[i] = [xi, yi] represents that the player x picked a ball of color y. Player i wins the game 2024-11-22 #leetcode #array #hashmap #java #counting sort
[LeetCode] 2257. Count Unguarded Cells in the Grid You are given two integers m and n representing a 0-indexed m x n grid. You are also given two 2D integer arrays guards and walls where guards[i] = [rowi, coli] and walls[j] = [rowj, colj] r 2024-11-21 #leetcode #array #java #flood fill #matrix #simulation
[LeetCode] 2516. Take K of Each Character From Left and Right You are given a string s consisting of the characters ‘a’, ‘b’, and ‘c’ and a non-negative integer k. Each minute, you may take either the leftmost character of s, or the rightmost character of s. Ret 2024-11-20 #leetcode #hashmap #java #sliding window #string
[LeetCode] 1652. Defuse the Bomb You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and a key k. To decrypt the code, you must replace every number. All t 2024-11-18 #leetcode #array #java #sliding window
[LeetCode] 661. Image Smoother An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cel 2024-11-17 #leetcode #array #java #matrix
[LeetCode] 911. Online Election You are given two integer arrays persons and times. In an election, the ith vote was cast for persons[i] at time times[i]. For each query at a time t, find the person that was leading the election at 2024-11-15 #leetcode #array #hashmap #java #binary search #design
[LeetCode] 1146. Snapshot Array Implement a SnapshotArray that supports the following interface:SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0.void set(inde 2024-11-14 #leetcode #array #hashmap #java #treemap #binary search #design
[LeetCode] 2080. Range Frequency Queries Design a data structure to find the frequency of a given value in a given subarray. The frequency of a value in a subarray is the number of occurrences of that value in the subarray. Implement the Ran 2024-11-14 #leetcode #array #hashmap #java #binary search #design
[LeetCode] 3239. Minimum Number of Flips to Make Binary Grid Palindromic I You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip any number of cells in grid from 0 to 1, or from 1 t 2024-11-14 #leetcode #array #two pointer #java #matrix