Count Paths in a Matrix & Max product sum cutting