package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/remove-sub-folders-from-the-filesystem/
 */
public class Problem1233 {
    public List<String> removeSubfolders(String[] folder) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1233 prob = new Problem1233();
        System.out.println(prob.removeSubfolders(
            new String[]{"/a","/a/b","/c/d","/c/d/e","/c/f"})); // ["/a","/c/d","/c/f"]
        System.out.println(prob.removeSubfolders(
            new String[]{"/a","/a/b/c","/a/b/d"})); // ["/a""]
        System.out.println(prob.removeSubfolders(
            new String[]{"/a/b/c","/a/b/ca","/a/b/d"})); // ["/a/b/c","/a/b/ca","/a/b/d"]
    }
}

@@ -33,13 +33,89 @@
 til.
+Array
 List;
+%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Set;
 %0A%0A/*
@@ -292,132 +292,104 @@
     
-// TODO%0A        return null;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1233 prob = new Problem1233(
+Set%3CString%3E answer = new HashSet%3C%3E();%0A        for (String f : folder) %7B%0A            answer.add(f
 );%0A 
@@ -398,50 +398,44 @@
     
+ 
- System.out.println(prob.removeSub
+%7D%0A        for (String f : 
 folder
-s(
+) %7B
 %0A   
@@ -439,36 +439,32 @@
             
-new 
 String%5B%5D
 %7B%22/a%22,%22/a/b%22
@@ -455,324 +455,360 @@
 ng%5B%5D
-%7B%22/a%22,%22/a/b%22,%22/c/d%22,%22/c/d/e%22,%22/c/f%22%7D)); // %5B%22/a%22,%22/c/d%22,%22/c/f%22%5D%0A        System.out.println(prob.removeSubfolders(%0A            new String%5B%5D%7B%22/a%22,%22/a/b/c%22,%22/a/b/d%22%7D)); // %5B%22/a%22%22%5D%0A        System.out.println(prob.removeSubfolders(%0A            new String%5B%5D%7B%22/a/b/c%22,%22/a/b/ca%22,%22/a/b/d%22%7D)); // %5B%22/a/b/c%22,%22/a/b/ca%22,%22/a/b/d%22%5D
+ split = f.split(%22/%22);%0A            String tmp = %22%22;%0A            for (int i = 1; i %3C split.length; i++) %7B%0A                tmp += %22/%22 + split%5Bi%5D;%0A                if (!tmp.equals(f) && answer.contains(tmp)) %7B%0A                    answer.remove(f);%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return new ArrayList%3C%3E(answer);
 %0A   

Solve problem 1233