第一题,回溯找到所有的递增序列,然后每次递归都判断剩下未标记的数字是否严格递减     static int[] book;     static int[] nums;     static int n;     static List<Integer> path = new ArrayList<>();     public static void main(String[] args)  {         nums = new int[]{8,6,1,3,2,4,5};         n = nums.length;         book = new int[n];         dfs(0,Integer.MIN_VALUE);     }     public static void dfs(int beg,int pre){         if(check())//每次check一下剩下的数组是否完全递减             System.out.println(path);         for(int i = beg; i < n; i++){//每次从上一个数的下标+1开始             if(book[i] == 0){                 if(nums[i] > pre){//如果本次是递增的才继续递归                     book[i] = 1;                     path.add(nums[i]);                     dfs(i+1,nums[i]);                     path.remove(path.size()-1);                     book[i] = 0;                 }             }         }     } //所有符合的解 [1, 3, 4, 5] [1, 2, 4, 5] [1, 4, 5]