goden1724

package
v0.0.0-...-b071cee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

面试题 17.24.最大子矩阵

1. 题目描述

给定一个正整数、负整数和 0 组成的 N x M 矩阵,编写代码找出元素总和最大的子矩阵。

返回一个数组 [r1, c1, r2, c2] ,其中 r1 , c1 分别代表子矩阵左上角的行号和列号, r2 , c2 分别代表右下角的行号和列号。若有多个满足条件的子矩阵,返回任意一个均可。

注意: 本题相对书上原题稍作改动

示例:

输入:
[
   [-1,0],
   [0,-1]
]
输出:[0,1,0,1]
解释:输入中标粗的元素即为输出所表示的矩阵

说明:

  • 1 <= matrix.length, matrix[0].length <= 200

标签 数组 动态规划 矩阵 前缀和

2. 解题

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL