← Back to all problems
Medium

Target Sum Ways

Updated Feb 24, 2026

Problem

Assign + or - to each number. Return number of ways to reach target.

Constraints

1 <= nums.length <= 20

Examples

Example 1

Input: {"nums": [1, 1, 1, 1, 1], "target": 3}
Output: 5

Function Signature

def findTargetSumWays(self, nums: list[int], target: int) -> int

How to Submit

Implement a Solution class with a findTargetSumWays method.

Your method will be called with the input parameters and should return the answer.