package leetcode;

/**
 * https://leetcode.com/problems/split-a-string-into-the-max-number-of-unique-substrings/
 */
public class Problem1593 {
    public int maxUniqueSplit(String s) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1593 prob = new Problem1593();
        System.out.println(prob.maxUniqueSplit("ababccc")); // 5
        System.out.println(prob.maxUniqueSplit("aba")); // 2
        System.out.println(prob.maxUniqueSplit("aa")); // 1
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -240,32 +240,52 @@
     
-// TODO%0A        return 0
+return maxUniqueSplit(s, 0, new HashSet%3C%3E())
 ;%0A  
@@ -298,21 +298,22 @@
    p
-ublic
+rivate
  static 
 void
@@ -312,266 +312,400 @@
 tic 
-void main(String%5B%5D args) %7B%0A        Problem1593 prob = new Problem1593();%0A        System.out.println(prob.maxUniqueSplit(%22ababccc%22)); // 5%0A        System.out.println(prob.maxUniqueSplit(%22aba%22)); // 2%0A        System.out.println(prob.maxUniqueSplit(%22aa%22)); // 1
+int maxUniqueSplit(String s, int i, Set%3CString%3E set) %7B%0A        int max = set.size();%0A        for (int j = i; j %3C s.length(); j++) %7B%0A            String sub = s.substring(i, j + 1);%0A            if (!set.contains(sub)) %7B%0A                set.add(sub);%0A                max = Math.max(max, maxUniqueSplit(s, j + 1, set));%0A                set.remove(sub);%0A            %7D%0A        %7D%0A        return max;
 %0A   

Solve problem 1593