[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
[LeetCode] 2064. Minimized Maximum of Products Distributed to Any Store You are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexed integer array quantities, where quantities[i] re 2024-11-13 #leetcode #array #java #binary search #binary search on answer
[LeetCode] 1385. Find the Distance Value Between Two Arrays Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements arr1[i] such that there is not any 2024-11-13 #leetcode #java #sort #binary search
[LeetCode] 2070. Most Beautiful Item for Each Query You are given a 2D integer array items where items[i] = [pricei, beautyi] denotes the price and beauty of an item respectively. You are also given a 0-indexed integer array queries. For each quer 2024-11-13 #leetcode #array #java #sort #binary search
[LeetCode] 3090. Maximum Length Substring With Two Occurrences Given a string s, return the maximum length of a substring such that it contains at most two occurrences of each character. Example 1:Input: s = “bcbbbcba”Output: 4 Explanation:The following subs 2024-11-09 #leetcode #hashmap #java #sliding window #string