Help with dynamic programming I am stuck in dynamic programming(self studying) for I understand the things written in my book but dont have a…