Hacker News new | ask | show | jobs
by oleg_kikin 5427 days ago
The first question needs a much larger matrix. I started writing the code, but then looked at the letters and saw the solution.
1 comments

there is O(m*n) solution for problem 1.
Yeah, dynamic programming. It's a well known problem. I'm pretty sure you can just convert the matrix to 1s and 0s, and dump it into Matlab.
Is it DP? I think DP is O(N^3)? That will be a funny way(Matlab) to solve this...
Eh, why not just use a flood-fill type algorithm?
Wouldn't the constrained that output area should be for a rectangle cause a problem?