Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMatrix ¶
GenerateMatrix generates an n x n matrix filled with elements from 1 to n2 in spiral order.
func KWeakRows ¶
KWeakRows the indices of the k weakest rows in the matrix ordered from weakest to strongest, mat is an m x n binary matrix. A row i is weaker than a row j if one of the following is true: - The number of 1 in row i is less than the number of 1 in row j. - Both rows have the same number of 1 and i < j.
func SpiralOrder ¶
SpiralOrder returns all elements of the matrix in spiral order.
Types ¶
type NumMatrix ¶
type NumMatrix struct {
// contains filtered or unexported fields
}
NumMatrix is used to calculate matrix region sum.
func NewNumMatrix ¶
NewNumMatrix builds NumMatrix from [][]int slice.
Click to show internal directories.
Click to hide internal directories.