java.lang.Object
g1301_1400.s1304_find_n_unique_integers_sum_up_to_zero.Solution

public class Solution extends Object
1304 - Find N Unique Integers Sum up to Zero.<p>Easy</p> <p>Given an integer <code>n</code>, return <strong>any</strong> array containing <code>n</code> <strong>unique</strong> integers such that they add up to <code>0</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> n = 5</p> <p><strong>Output:</strong> [-7,-1,1,3,4]</p> <p><strong>Explanation:</strong> These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> n = 3</p> <p><strong>Output:</strong> [-1,0,1]</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> n = 1</p> <p><strong>Output:</strong> [0]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= n <= 1000</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • sumZero

      public int[] sumZero(int n)