Need Help in solving this kind of problems

I just started coding and practiced Dyanmic programming and graphs . But I’m not able solve this kind of problems
(https://drive.google.com/file/d/1l80-tIb1Rro39AM2MoFkWN0MRuH2e-Rl/view?usp=sharing)
could anyone help me how to solve this? and if possible please share resources where I can find these type of questions;
i think this we have to use dynamic programming on graphs . can anyone share that resources if possible?