package leetcode;

/**
 * https://leetcode.com/problems/di-string-match/
 */
public class Problem942 {
    public int[] diStringMatch(String S) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem942 prob = new Problem942();
    }
}

@@ -151,131 +151,618 @@
     
-// TODO%0A        return null;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem942 prob = new Problem942()
+int start = 0;%0A        int end = S.length();%0A        int%5B%5D result = new int%5BS.length() + 1%5D;%0A        int index = 0;%0A        boolean increase = false;%0A        for (int i = 0; i %3C S.length(); i++) %7B%0A            if (S.charAt(i) == 'I') %7B%0A                result%5Bindex%5D = start++;%0A                increase = true;%0A            %7D else %7B // S.charAt(i) == 'D'%0A                result%5Bindex%5D = end--;%0A                increase = false;%0A            %7D%0A            index++;%0A        %7D%0A        if (increase) %7B%0A            result%5Bindex%5D = start;%0A        %7D else %7B%0A            result%5Bindex%5D = end;%0A        %7D%0A        return result
 ;%0A  

Solve problem 942