package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/minimum-subsequence-in-non-increasing-order/
 */
public class Problem1403 {
    public List<Integer> minSubsequence(int[] nums) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1403 prob = new Problem1403();
        System.out.println(prob.minSubsequence(new int[]{4,3,10,9,8})); // [10,9]
        System.out.println(prob.minSubsequence(new int[]{4,4,7,6,7})); // [7,7,6]
        System.out.println(prob.minSubsequence(new int[]{6})); // [6]
    }
}

@@ -12,16 +12,69 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Arrays;%0A
 import j
@@ -88,16 +88,16 @@
 l.List;%0A
-
 %0A/**%0A * 
@@ -268,368 +268,402 @@
     
-// TODO%0A        return null
+Arrays.sort(nums);%0A        int sum = 0
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1403 prob = new Problem1403();%0A        System.out.println(prob.minSubsequence(new int%5B%5D%7B4,3,10,9,8%7D)); // %5B10,9%5D%0A        System.out.println(prob.minSubsequence(new int%5B%5D%7B4,4,7,6,7%7D)); // %5B7,7,6%5D%0A        System.out.println(prob.minSubsequence(new int%5B%5D%7B6%7D)); // %5B6%5D
+for (int num : nums) %7B%0A            sum += num;%0A        %7D%0A        List%3CInteger%3E answer = new ArrayList%3C%3E();%0A        int tmp = 0;%0A        for (int i = nums.length - 1; i %3E= 0; i--) %7B%0A            tmp += nums%5Bi%5D;%0A            answer.add(nums%5Bi%5D);%0A            if (sum - tmp %3C tmp) %7B%0A                break;%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1403