d-Matrix interview question

dynamic programming to partition array with minimum sum difference.