Repository navigation
Expand file tree
/
Copy pathMain.java
More file actions
70 lines (49 loc) · 1.58 KB
/
Copy pathMain.java
File metadata and controls
70 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Arrays.LetcodeProblems.p3.Solution3;
// import LikedLists.*;
/**
* @author Nelson Alexandre Mutane
*
*/
public class Main {
public static void main(String[] args) {
// DoubleLinkedList lists = new DoubleLinkedList();
// lists.insertEnd(15);
// lists.insertEnd(154);
// lists.insertEnd(155);
// lists.insertAt(3,1545);
// System.out.println(lists.toString());
// System.out.println(lists.getLenght());
// lists.deleteAt(0);
// lists.deleteAt(0);
// lists.deleteAt(0);
// lists.deleteAt(0);
// lists.insertEnd(155);
// lists.insertEnd(155);
// lists.insertEnd(155);
// lists.insertEnd(155);
// lists.updateAt(4, 4);
// System.out.println(lists.getLenght());
// System.out.println(lists.toString());
// Solution3 s3 = new Solution3();
int ar[] = {0,2,1,5,3,4};
// int ans[] = new int[ar.length];
// for (int i = 0; i < ar.length; i++) {
// ans[i] = ar[ar[i]];
// }
// for (int i : ans) {
// System.out.println(ans[i]);
// }
// // System.out.println(s3.removeElement(ar, 3));
// 1,2 ,3 ,4,5 ,6,7, 8,9,10
sum(1,2,3,4);
}
public static void sum(int ...nums) {
int sum =0;
int[] ans = new int[nums.length];
for(int i = 0 ; i < nums.length; i++){
sum += nums[i];
ans[i] = sum;
System.out.print("," + ans[i]);
}
}
}