EDITORIAL SOLUTION IS ACCORDING TO DYNAMIC PROGRAMMING

please give an solution without it as in this course dp is not taught

hi @computer.engineer.veenit.kumar refer