Find the biggest rectangular area consisting only of 2 types of letter
I need help with a problem.
Given a MxN board represented with M letters (a, z) in each of the N lines, i have to find the biggest area in which there are only 2 types of letters in it. The area must have rectangular shape. Here's an example :
Code:
4 4
AAAA
ABBC
BBCA
DCAA
The output will be 6, because the biggest rectangular area in which there are only 2 types of letters is in the upper corner AAA-ABB, there are only A and B (2 types).
Please help me, it's urgent.
Thank you in advance.