C++ solution to Maximal Rectangle