My first thought made it unnecessarily difficult. Well, the correct solution falls into a typical pattern: use DP to calc cumulative results of each cell, and then we use a sliding window to find max rect btw. 2 given rows.
My first thought made it unnecessarily difficult. Well, the correct solution falls into a typical pattern: use DP to calc cumulative results of each cell, and then we use a sliding window to find max rect btw. 2 given rows.