https://www.geeksforgeeks.org/minimum-cost-cut-board-squares/