Search
⌘K
Get Premium
Leetcode 562. Longest Line of Consecutive One in Matrix
Given a binary matrix, return the length of the longest consecutive line of 1s appearing horizontally, vertically, diagonally, or anti-diagonally. Typical solutions scan the matrix while maintaining counts for the four directions per cell (DP/directional accumulation) to achieve O(mn) time.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.