Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 494. Target Sum
Count how many ways to assign +/− to each element of nums so the signed sum equals target. This reduces to a subset-sum problem: count subsets with sum (sum(nums)+target)/2 (must be integral and nonnegative), typically solved with DP — watch parity and zeros.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early November, 2025
Meta
Mid-level
Mid September, 2024
Meta
Senior
Target Sum: Given an array of integers and a target sum, find the number of ways to assign + and - signs to the integers so that the sum of the resulting expression equals the target sum.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.