# Explain how to find a target sum in an array

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/1439/find-target-sum-array
Source observed: 2026-11-04T22:21:38.173Z
Last checked: 2026-11-04T22:21:38.173+00:00
Indexed: 2026-11-06T17:59:03.756+00:00

---

# Explain how to find a target sum in an array

**Difficulty:** Medium

**Aced (formerly Exponent)** coding interview question for software engineers. The question is categorized under [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms) and [Coding](https://www.aced.io/questions?type=coding), and is associated with [Adobe](https://www.aced.io/questions?company=adobe), [Google](https://www.aced.io/questions?company=google), and [Meta](https://www.aced.io/questions?company=meta-facebook).

## Problem

Determine the number of ways to assign symbols to reach a target sum. Given a list of non-negative integers `a1, a2, ..., an` and a target sum `S`, assign either `+` or `-` to every integer. Return the total number of distinct symbol arrangements whose signed sum equals `S`.

For example, with `[1, 1, 1, 1, 1]` and target `3`, one valid arrangement assigns plus signs to three `1`s and minus signs to two `1`s. The arrangements are counted separately according to which list positions receive each sign. Another valid arrangement is `+1 -1 +1 +1 +1`.

## Examples

| Input | Output | Explanation |
|---|---:|---|
| `nums = [1, 1, 1, 1, 1]`, `targetSum = 3` | `5` | Five unique sign assignments reach the target. |
| `nums = [1, 2, 1]`, `targetSum = 2` | `2` | Two sign assignments reach the target. |
| `nums = [1, 2, 7, 1, 5, 3]`, `targetSum = 8` | `-1` | The total sum of the numbers plus the target is odd, so reaching the target is not possible. |

## Available workspace

The interface includes an editor with **Output**, **Test Results**, and **Console** areas. Use [Sign up to run code](https://www.aced.io/signup?src=lesson) to run code.

The community section currently has no contributed answers.

## Related questions

- [Find a triplet in an array with a given sum.](https://www.aced.io/questions/1127/find-triplet-with-given-sum)
- [Given an array, find the two sum.](https://www.aced.io/questions/1164/find-two-sum)
- [Find quadruplets in an array with a given sum.](https://www.aced.io/questions/1129/find-quadruplets-with-given-sum)

## Related courses

### [Software Engineering Interview Prep](https://www.aced.io/courses/software-engineering)

![Software Engineering Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/4VkuYewBHUFIVUS5oJDW5h/02e833439b1289f25f38f13f81cbdca3/adobe_stock_optimized.jpeg?w=800&h=800&fm=webp&q=75)

Prepare for software engineering interviews at Google, Amazon, Microsoft, Meta, Apple, and other top companies with mock interviews, frameworks, and advice from senior candidates. Topics include data structures, algorithms, system design, people management, behavioral interviews, and more.

### [System Design Interviews](https://www.aced.io/courses/system-design-interviews)

![System Design Interviews](https://images.ctfassets.net/x78yjrjc11pq/78x7miFZFjBCrM5GqftrMJ/2f6d26e632c4e7265c49f6a180227edb/system_design_track_compressed_26ac98a46e__281_29_5be2280f31.jpeg?w=800&h=800&fm=webp&q=75)

Learn to answer system design questions across product, infrastructure, and AI domains through in-depth video examples, written breakdowns, reference patterns, and mock interview videos with senior engineers and managers.

## Aced interview preparation areas

We provide courses and practice across Product Management, Forward Deployed Engineering, Engineering Management, Software Engineering, System Design, Data Science, Machine Learning, Data Engineering, AI Engineering, Investment Banking, Generative AI, Security Engineering, TPM, Solutions Architecture, UX / Product Design, and BizOps & Strategy. We also provide interview questions, practice, coaching, resume review, salary negotiation, job referrals, and related resources.

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F1439%2Ffind-target-sum-array&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F1439%2Ffind-target-sum-array). Opening a form does not execute a tool.