CSES : Two Sets II (most optimal solution)

Revision en1, by The_Elephant, 2024-12-07 19:22:14

This is one of the new added problem for dp(dynamic programming) on cses.

Task : Link

It is similar to 0/1 knapsack or subset sum equal to k. I have solved this problem using a single array.

TC : O(N*M)
SC : O(M)

Solution
Code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English The_Elephant 2024-12-07 19:22:14 1874 Initial revision (published)