My intuition is flood-fill the BFS solution, which is O(n^4); and then I figured out a DP solution which is O(n^4)..
So I googled some hints: it can be built upon another LeetCode problem: Largest Rectangle in Histogram. With proper pre-calculation, we can make a O(n^3) solution. What's more, we can start from bottom-right to upper-left, and then make sure each '1' cell is visited only once - that's O(n^2).
http://yucoding.blogspot.com/2013/01/incomplete-leetcode-question-47-maximal.html
And as always, there's such a great solution: https://leetcode.com/discuss/20240/share-my-dp-solution