Query regarding Question. The pick and not pick logic is not Working

Revision en1, by anmolsainiii23, 2023-12-03 11:05:00

Hi I was wondering how to solve this question. The question actually came today in the weekly contest. The Question Name is -: 2952. Minimum Number of Coins to be Added . And my general approach was to just try recursion here and use pick and not pick approach to find out the element from 1 to Target. It's giving me wrong answer in the Tc -: [1,4,10] Target -: 19. My answer is 3 while the correct answer is 2. Can we try this approach to find out the answer. I know it will give the TLE but just for the practice purpose I want to try recursion here.

Submission Link -: https://leetcode.com/submissions/detail/1111336437/

Tags recursion, dynamic programming, greedy

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English anmolsainiii23 2023-12-03 11:05:00 696 Initial revision (published)