原文链接: https://leetcode-cn.com/problems/flip-columns-for-maximum-number-of-equal-rows 英文原文You are given an m x n binary matrix matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the…
标签详情
矩阵 分类
原文链接: https://leetcode-cn.com/problems/minimum-falling-path-sum-ii 英文原文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…
原文链接: https://leetcode-cn.com/problems/number-of-paths-with-max-score 英文原文You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'. You need to reach the top left square m…
原文链接: https://leetcode-cn.com/problems/largest-1-bordered-square 英文原文Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in the grid. Example 1:…
原文链接: https://leetcode-cn.com/problems/matrix-block-sum 英文原文Given a m x n matrix mat and an integer k, return a matrix answer where each answer[i][j] is the sum of all elements mat[r][c] for: i - k <= r <= i + k, j - k <= c <= j + k, and (r, c) is a …
原文链接: https://leetcode-cn.com/problems/sort-the-matrix-diagonally 英文原文A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix…
原文链接: https://leetcode-cn.com/problems/rank-transform-of-a-matrix 英文原文Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank is an integer that represents how large an element is compared to…
原文链接: https://leetcode-cn.com/problems/largest-magic-square 英文原文A k x k magic square is a k x k grid filled with integers such that every row sum, every column sum, and both diagonal sums are all equal. The integers in the magic square do not have to…
原文链接: https://leetcode-cn.com/problems/minimum-moves-to-reach-target-with-rotations 英文原文In an n*n grid, there is a snake that spans 2 cells and starts moving from the top left corner at (0, 0) and (0, 1). The grid has empty cells represented by zeros…
原文链接: https://leetcode-cn.com/problems/where-will-the-ball-fall 英文原文You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corner…
原文链接: https://leetcode-cn.com/problems/path-with-maximum-gold 英文原文In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the maximum amount of gold you can colle…
原文链接: https://leetcode-cn.com/problems/queens-that-can-attack-the-king 英文原文On an 8x8 chessboard, there can be multiple Black Queens and one White King. Given an array of integer coordinates queens that represents the positions of the Black Queens, an…
原文链接: https://leetcode-cn.com/problems/reconstruct-a-2-row-binary-matrix 英文原文Given the following details of a matrix with n columns and 2 rows : The matrix is a binary matrix, which means each element in the matrix can be 0 or 1. The sum of elements …
原文链接: https://leetcode-cn.com/problems/shift-2d-grid 英文原文Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j + 1]. Element at grid[i][n - 1] moves to gri…
原文链接: https://leetcode-cn.com/problems/minimum-moves-to-move-a-box-to-their-target-location 英文原文A storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations. The game is represented by an m x n…
原文链接: https://leetcode-cn.com/problems/count-servers-that-communicate 英文原文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 serv…
原文链接: https://leetcode-cn.com/problems/find-winner-on-a-tic-tac-toe-game 英文原文Tic-tac-toe is played by two players A and B on a 3 x 3 grid. The rules of Tic-Tac-Toe are: Players take turns placing characters into empty squares ' '. The first player A …
原文链接: https://leetcode-cn.com/problems/count-square-submatrices-with-all-ones 英文原文Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] ] Output: 15 Expl…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix 英文原文Given a m x n binary matrix mat. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is chang…
原文链接: https://leetcode-cn.com/problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold 英文原文Given a m x n matrix mat and an integer threshold. Return the maximum side-length of a square with a sum less than or equal to thresho…
原文链接: https://leetcode-cn.com/problems/shortest-path-in-a-grid-with-obstacles-elimination 英文原文You are given an m x n integer matrix grid where each cell is either 0 (empty) or 1 (obstacle). You can move up, down, left, or right from and to an empty c…
原文链接: https://leetcode-cn.com/problems/the-k-weakest-rows-in-a-matrix 英文原文You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers are positioned in front of the civilians. That is, all th…
原文链接: https://leetcode-cn.com/problems/maximum-students-taking-exam 英文原文Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character. Stud…
原文链接: https://leetcode-cn.com/problems/count-negative-numbers-in-a-sorted-matrix 英文原文Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Example 1: Input: gri…
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid 英文原文Given a 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…
原文链接: https://leetcode-cn.com/problems/lucky-numbers-in-a-matrix 英文原文Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its…
原文链接: https://leetcode-cn.com/problems/check-if-there-is-a-valid-path-in-a-grid 英文原文Given a m x n grid. Each cell of the grid represents a street. The street of grid[i][j] can be: 1 which means a street connecting the left cell and the right cell. 2 …
原文链接: https://leetcode-cn.com/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows 英文原文You are given an m * n matrix, mat, and an integer k, which has its rows sorted in non-decreasing order. You are allowed to choose exactly 1 element fro…
原文链接: https://leetcode-cn.com/problems/number-of-ways-of-cutting-a-pizza 英文原文Given a rectangular pizza represented as a rows x cols matrix containing the following characters: 'A' (an apple) and '.' (empty cell) and given the integer k. You have to c…
原文链接: https://leetcode-cn.com/problems/cherry-pickup-ii 英文原文Given a rows x cols matrix grid representing a field of cherries. Each cell in grid represents the number of cherries that you can collect. You have two robots that can collect cherries for …