5
5
import java .util .List ;
6
6
import java .util .Set ;
7
7
8
- /**
9
- * 491. Increasing Subsequences
10
- *
11
- * Given an integer array, your task is to find all the different possible increasing subsequences of the given array,
12
- * and the length of an increasing subsequence should be at least 2 .
13
-
14
- Example:
15
- Input: [4, 6, 7, 7]
16
- Output: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7, 7], [7,7], [4,7,7]]
17
-
18
- Note:
19
- The length of the given array will not exceed 15.
20
- The range of integer in the given array is [-100,100].
21
- The given array may contain duplicates, and two equal integers should also be considered as a special case of increasing sequence.
22
- */
23
8
public class _491 {
24
9
25
10
public static class Solution1 {
@@ -33,7 +18,7 @@ public List<List<Integer>> findSubsequences(int[] nums) {
33
18
}
34
19
35
20
private Set <List <Integer >>backtracking (int []nums ,int start ,List <Integer >currList ,
36
- Set <List <Integer >>answer ) {
21
+ Set <List <Integer >>answer ) {
37
22
if (currList .size () >=2 ) {
38
23
answer .add (new ArrayList <>(currList ));
39
24
}