Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Subset Sum with n up to 40

Print YES if some subset of the given numbers sums exactly to target, otherwise NO. n can be 40, which is too large for 2^n brute force.

Constraints

1 <= n <= 40 1 <= nums[i] <= 10^9

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.