cpp implementation of Maximal Rectangle