Longest Line of Consecutive One in a Matrix


There is a O(mn) time O(1) space solution as well. check this out
https://discuss.leetcode.com/topic/87416/omntimenoextraspacesolution

@sean46 old/prev is used to store the previous dp[j][2] value. In jth iteration dp[j][2] will be updated, therefore we are storing the value of dp[j][2] in "old" variable so that we can use it in (j+1)th iteration.

There is another O(mn) time O(1) space solution. Must see!
https://discuss.leetcode.com/topic/106745/javao1spaceandomntime69runningtimepercentile