Tap here to switch tabs
Problem
Submissions

Problem: Find N Unique Integers Sum up to Zero

med
30 min
Try to solve the Find N Unique Integers Sum up to Zero problem.

Statement

Given an integer n, construct and return an array of n distinct integers such that the sum of all elements is equal to 00. If multiple valid arrays exist, you may return any one of them.

Constraints:

  • 1≤1 \leq n ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find N Unique Integers Sum up to Zero

med
30 min
Try to solve the Find N Unique Integers Sum up to Zero problem.

Statement

Given an integer n, construct and return an array of n distinct integers such that the sum of all elements is equal to 00. If multiple valid arrays exist, you may return any one of them.

Constraints:

  • 1≤1 \leq n ≤103\leq 10^3