HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by rajatsuri | Hacker News Reader
Parent
Full thread
rajatsuri
·
nice work!
View on HN
oleg_kikin
·
The first question needs a much larger matrix. I started writing the code, but then looked at the letters and saw the solution.
rohananil
·
there is O(m*n) solution for problem 1.
oleg_kikin
·
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.
rohananil
·
Is it DP? I think DP is O(N^3)? That will be a funny way(Matlab) to solve this...
Joshim5
·
Eh, why not just use a flood-fill type algorithm?
rohananil
·
Wouldn't the constrained that output area should be for a rectangle cause a problem?
Reply on news.ycombinator.com