#leetcode #medium #barclays 3070. Count Submatrices with Top-Left Element and Sum Less Than k Дейлик литкода 18.03.2026 You are given a 0-indexed integer matrix grid and an integer k. Return the number of submatrices that contain the top-left element of the grid, and have a sum less than or equal to k. Мы начинаем с верхнего левого угла и обходим матрицу в порядке строк, рассматривая каждую позицию (i,j)в качестве нижнего правого угла подматрицы. Для эффективного вычисления сумм подматриц за оди...
What color is your bugatti?
Я не боюсь того, кто изучил 10 000 различных алгоритмов. Я боюсь того, кто изучил один алгоритм 10 000 раз
Графики
📊 Средний охват постов
📉 ERR % по дням
📋 Публикации по дням
📎 Типы контента
Лучшие публикации
15 из 15#leetcode #medium #google #directi 1727. Largest Submatrix With Rearrangements Дейлик литкода 17.03.2026 You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order. Return the area of the…
#leetcode #medium #microsoft 3212. Count Submatrices With Equal Frequency of X and Y Дейлик литкода 19.03.2026 Given a 2D character matrix grid, where grid[i][j] is either 'X', 'Y', or '.', return the number of submatrices that contain: grid[0][0] an equal frequency of 'X' and 'Y'. at least one 'X'. По сути задачка такая же, как вчера. Только литкод какое-то кривоватое решение решение предлагает. Вчерашнее адаптировал. class Solution { public int numberOfSubmatrices(char[][] grid) { int n = grid...
#leetcode #medium #google #directi 1727. Largest Submatrix With Rearrangements Дейлик литкода 17.03.2026 You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order. Return the area of the largest submatrix within matrix where every element of the submatrix is 1 after reordering the columns optimally. Идея: Максимальная площадь прямоугольника из единиц = ширина × высота. Строки переставлять нельзя → высота фиксирована. Столбцы перес...
#leetcode #medium # 3567. Minimum Absolute Difference in Sliding Submatrix Дейлик литкода 20.03.2026 You are given an m x n integer matrix grid and an integer k. For every contiguous k x k submatrix of grid, compute the minimum absolute difference between any two distinct values within that submatrix. Return a 2D array ans of size (m - k + 1) x (n - k + 1), where ans[i][j] is the minimum absolute difference in the submatrix whose top-left corner is (i, j) in grid. Note: If all elements in the su...
#leetcode #easy 3643. Flip Square Submatrix Vertically Дейлик литкода 21.03.2026 You are given an m x n integer matrix grid, and three integers x, y, and k. The integers x and y represent the row and column indices of the top-left corner of a square submatrix and the integer k represents the size (side length) of the square submatrix. Your task is to flip the submatrix by reversing the order of its rows vertically. Return the updated matrix. class Solution { public int[][] reverseSubmatrix(int[]...
#leetcode #hard 3548. Equal Sum Grid Partition II Дейлик литкода 26.03.2026 You are given an m x n matrix grid of positive integers. Your task is to determine if it is possible to make either one horizontal or one vertical cut on the grid such that: Each of the two resulting sections formed by the cut is non-empty. The sum of elements in both sections is equal, or can be made equal by discounting at most one single cell in total (from either section). If a cell is discounted, the rest of the sec...
#leetcode #medium #google 1594. Maximum Non Negative Product in a Matrix Дейлик литкода 23.03.2026 You are given a m x n matrix grid. Initially, you are located at the top-left corner (0, 0), and in each step, you can only move right or down in the matrix. Among all possible paths starting from the top-left corner (0, 0) and ending in the bottom-right corner (m - 1, n - 1), find the path with the maximum non-negative product. The product of a path is the product of all integers in the grid cells...
#leetcode #easy #microsoft #salesforce 2946. Matrix Similarity After Cyclic Shifts Дейлик литкода 27.03.2026 You are given an m x n integer matrix mat and an integer k. The matrix rows are 0-indexed. The following proccess happens k times: Even-indexed rows (0, 2, 4, ...) are cyclically shifted to the left. Odd-indexed rows (1, 3, 5, ...) are cyclically shifted to the right. Return true if the final modified matrix after k steps is identical to the original matrix, and false otherwise. Определен...
#leetcode #medium #amazon 2906. Construct Product Matrix Дейлик литкода 24.03.2026 Given a 0-indexed 2D integer matrix grid of size n m, we define a 0-indexed 2D matrix p of size n m as the product matrix of grid if the following condition is met: Each element p[i][j] is calculated as the product of all elements in grid except for the element grid[i][j]. This product is then taken modulo 12345. Return the product matrix of grid. Представляем матрицу как одномерный массив N = n m; // всего элемен...