文章 2021-03-29 来自:开发者社区

[leetcode/lintcode 题解] 算法面试真题:233矩阵 · 233 Matrix

描述给出一个矩阵A,矩阵的第一行是0,233,2333,23333...(也就是说,A(0,0)=0,A(0,1)=233,A(0,2)=2333,A(0,3)=23333...),除此之外,A(i,j)=A(i-1,j)+A(i,j-1)。给出一个拥有n个整数的数组X,X[i]表示A(i+1,0),(也就是说X[0]表示A(1,0),X[1]表示A(2,0)...),以及一个正整数m。求A(n....

[leetcode/lintcode 题解] 算法面试真题:233矩阵 · 233 Matrix
文章 2020-06-02 来自:开发者社区

LeetCode 867. 转置矩阵

题目 给定一个矩阵 A, 返回 A 的转置矩阵。 矩阵的转置是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引。 示例 1: 输入:[[1,2,3],[4,5,6],[7,8,9]] 输出:[[1,4,7],[2,5,8],[3,6,9]] 示例 2: 输入:[[1,2,3],[4,5,6]] 输出:[[1,4],[2,5],[3,6]] 提示: 1 <...

文章 2019-09-17 来自:开发者社区

Leetcode 542:01 矩阵 01 Matrix

题目: 给定一个由 0 和 1 组成的矩阵,找出每个元素到最近的 0 的距离。 两个相邻元素间的距离为 1 。 Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. 示例 1: 输入: 0....

Leetcode 542:01 矩阵	01 Matrix
文章 2017-12-15 来自:开发者社区

[LeetCode] Longest Increasing Path in a Matrix 矩阵中的最长递增路径

Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside o....

文章 2017-12-15 来自:开发者社区

[LeetCode] Smallest Rectangle Enclosing Black Pixels 包含黑像素的最小矩阵

An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one black region. Pixels are connecte...

文章 2017-12-13 来自:开发者社区

[LeetCode] Max Sum of Rectangle No Larger Than K 最大矩阵和不超过K

Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k. Example: Given matrix = [ [1, 0,...

文章 2017-12-09 来自:开发者社区

[LeetCode] 01 Matrix 零一矩阵

Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1:  Input: 0 0 0 0 1 0 0 0 0 Output: 0 0 0 0 1 0 0 0 0 ...

文章 2017-12-08 来自:开发者社区

[LeetCode] Reshape the Matrix 重塑矩阵

In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. You're given a matrix represented by a two-dimen....

文章 2017-12-03 来自:开发者社区

[LeetCode] Search a 2D Matrix 搜索一个二维矩阵

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:  Integers in each row are sorted from left to right. The f...

文章 2017-12-03 来自:开发者社区

[LeetCode] Set Matrix Zeroes 矩阵赋零

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra space? A straight forward soluti...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注