Tap here to switch tabs
Problem
Submissions

Problem: Longest Line of Consecutive One in Matrix

med
30 min
Try to solve the Longest Line of Consecutive One in Matrix problem.

Statement

Given an m $ imes$ n binary matrix mat, return the length of the longest line of consecutive 11’s in the matrix.

The line can be horizontal, vertical, diagonal, or anti diagonal.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤104\leq 10^4

  • 1≤1 \leq m * n ≤104\leq 10^4

  • mat[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Line of Consecutive One in Matrix

med
30 min
Try to solve the Longest Line of Consecutive One in Matrix problem.

Statement

Given an m $ imes$ n binary matrix mat, return the length of the longest line of consecutive 11’s in the matrix.

The line can be horizontal, vertical, diagonal, or anti diagonal.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤104\leq 10^4

  • 1≤1 \leq m * n ≤104\leq 10^4

  • mat[i][j] is either 00 or 11.