Leetcode in Java && Oracle
422 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-10-18_15-30-00.png
28.4 KB
#N1304. Find N Unique Integers Sum up to Zero
problem link=>https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/

#solution
class Solution {
public int[] sumZero(int n) {
int[] arr=new int[n];
for(int i=0; i<n/2; i++){
arr[i]=i+1;
arr[n-i-1]=-i-1;
}

return arr;
}
}