I'm practicing problems and found this weird one. I can't figure out the best way to solve it.
You are given a 2D matrix size n*n with only 1's and 0's, you have to find the longest sequence of 1's either column-wise or row-wise.
I'm pretty stuck on this problem. I was trying to use a divide and conquer technique to split up the array into 4 n/2 * n/2 arrays, but the step where I merge together is still so slow because I have to check every adjacent row/column. Any advice on a fast solution would be great. I've spent way too much time staring at this.