Leetcode 491
    https://leetcode-cn.com/problems/increasing-subsequences/

    Given an integer array nums, return all the different possible increasing subsequences of the given array with at least two elements. You may return the answer in any order. The given array may contain duplicates, and two equal integers should also be considered a special case of increasing sequence.

    Example 1: Input: nums = [4,6,7,7] Output: [[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]

    Example 2: Input: nums = [4,4,3,2,1] Output: [[4,4]]

    Constraints: 1 <= nums.length <= 15 -100 <= nums[i] <= 100

    1. class Solution {
    2. List<List<Integer>> result = new ArrayList<>();
    3. LinkedList<Integer> list = new LinkedList<>();
    4. public List<List<Integer>> findSubsequences(int[] nums) {
    5. backTracking(nums, 0);
    6. return result;
    7. }
    8. public void backTracking(int nums[], int index){
    9. if(list.size() > 1){
    10. result.add(new ArrayList<>(list));
    11. }
    12. HashMap<Integer, Integer> map = new HashMap<>(); //使用map进行去重
    13. for(int i = index; i < nums.length; i++){
    14. if(list.size() > 0 && nums[i] < list.getLast()){
    15. continue;
    16. }
    17. //change from nums[i] i-1 to map
    18. if(map.getOrDefault(nums[i], 0) >= 1){
    19. continue;
    20. }
    21. map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
    22. list.add(nums[i]);
    23. backTracking(nums, i + 1);
    24. list.removeLast();
    25. }
    26. }
    27. }