You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ArrayList<Integer> list = newArrayList<>(); //if starting value(say n) is the last value , this will make a new list with the values and the new starting value is n
11
+
for(intnum: nums)
12
+
{
13
+
list.add(num);
14
+
}
15
+
result.add(list);
16
+
return;
17
+
}
18
+
19
+
for(inti=start; i<nums.length; i++) //a loop to keep on swapping as many times as there are values in the list
20
+
{
21
+
swap(nums, i, start);
22
+
helper(start+1, nums, result);
23
+
swap(nums, i, start);
24
+
}
25
+
}
26
+
27
+
privatevoidswap(int[] nums, inti, intj)
28
+
{
29
+
inttemp = nums[i]; //temp temporarily holds the value of nums so that i & j values can be exchanged
0 commit comments