Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int[] solution(int N) {
- if(N==2) {
- return new int[]{-1,1};
- }
- int[] solution = new int[N];
- int sum = 0;
- for(int i=0;i<solution.length-1;++i) {
- solution[i]=i;
- sum+=i;
- }
- solution[solution.length-1]=sum*-1;
- return solution;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement