PROBLEM LINK :Author: Himanshu Sharma DIFFICULTY:EasyMedium PREREQUISITES:Easy DP, Recursion. PROBLEM:chefs mom has collection of N chocolates. Each chocolate has different taste value. Mom has some rules, chef can eat atmost 3 chocolates in a row, to eat next chocolates he must skip atleast 1 chocolate. Chef wants to get maximum possible taste value. Find out maximum possible taste value chef can get. QUICK EXPLANATION:The above problem is standard DP problem. Let DP : 2d vector for storing intermediate values. DP[1][1]=DP[1][2]=DP[1][3]=DP[1][4]=V[1]; Complexity of Above solution is O(N) in worst case. Solution :Solution from a participated Team : Solution in cpp
This question is marked "community wiki".
asked 14 Feb '18, 23:09

Other Approaches are welcome. Please provide if you have one. answered 14 Feb '18, 23:13
