Skip to content

Instantly share code, notes, and snippets.

View nicolas-f's full-sized avatar

nicolas-f nicolas-f

View GitHub Profile
@nicolas-f
nicolas-f / dp.py
Last active August 29, 2015 13:57 — forked from zed/dp.py
#!/usr/bin/env python
"""Find height, width of the largest rectangle containing all 0's in the matrix.
The algorithm for `max_size()` is suggested by @j_random_hacker [1].
The algorithm for `max_rectangle_size()` is from [2].
The Python implementation [3] is under CC BY-SA 3.0
(if you need other license, e-mail me)
[1]: http://stackoverflow.com/questions/2478447/find-largest-rectangle-containing-only-zeros-in-an-nn-binary-matrix#comment5169734_4671342