Please read the new rule regarding the restriction on the use of AI tools. ×

What is wrong in my code ?

Revision en1, by Ghost_RNA, 2022-11-15 09:04:39

I am trying to solve this dp problem It looked similar to knapsack problem. so I tried to solve is that way. but the recursive version is giving tle so I tried to memoize it. it is giving correct answer on my local machine but it gives different answer when i submit it.

Problem Link
My Submission

on the first test case it gives 90 on my local machine but when i submit it it gives wrong answer as 80.
5
2 4 5 4 10
40 30 20 10 40

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ghost_RNA 2022-11-15 09:04:39 597 Initial revision (published)