Back to Browse

Money Sums (CSES) | Subset Sum DP Explained | Count All Possible Sums Using Dynamic Programming

468 views
Jul 30, 2025
32:38

In this video, we solve the ๐Œ๐จ๐ง๐ž๐ฒ ๐’๐ฎ๐ฆ๐ฌ problem from the ๐‚๐’๐„๐’ ๐ƒ๐ฒ๐ง๐š๐ฆ๐ข๐œ ๐๐ซ๐จ๐ ๐ซ๐š๐ฆ๐ฆ๐ข๐ง๐  section, which is a perfect example of the classic subset sum problem.โฃโฃ โฃโฃ Given a list of coins, we determine all the distinct positive sums that can be formed using any subset of the coins. This is a fundamental dynamic programming pattern that appears frequently in coding contests and interviews.โฃโฃ โฃโฃ ๐Ÿ’ก What you'll learn:โฃโฃ - How to use a boolean DP array to track achievable sumsโฃโฃ - Why reverse iteration avoids overcounting in subset sum problemsโฃโฃ - How to efficiently compute and extract all valid sumsโฃโฃ - Real-world applications of subset sum logicโฃโฃ โฃโฃ This problem is part of our full Dynamic Programming Series, featuring curated problems from ๐‚๐’๐„๐’, ๐€๐ญ๐‚๐จ๐๐ž๐ซ, ๐‚๐จ๐๐ž๐Ÿ๐จ๐ซ๐œ๐ž๐ฌ, ๐‹๐ž๐ž๐ญ๐œ๐จ๐๐ž, ๐‚๐จ๐๐ž๐‚๐ก๐ž๐Ÿ, and more โ€” moving from beginner-friendly explanations to advanced DP techniques.โฃโฃ โฃ Problem Link : https://cses.fi/problemset/task/1745โฃ โฃโฃ #MoneySums #SubsetSum #DynamicProgramming #CSES #CompetitiveProgramming

Download

0 formats

No download links available.

Money Sums (CSES) | Subset Sum DP Explained | Count All Possible Sums Using Dynamic Programming | NatokHD