package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/find-common-characters/
 */
public class Problem1002 {
    public List<String> commonChars(String[] A) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1002 prob = new Problem1002();
        System.out.println(prob.commonChars(new String[]{"bella", "label", "roller"})); // ["e","l","l"]
        System.out.println(prob.commonChars(new String[]{"cool", "lock", "cook"})); // ["c","o"]
    }
}

@@ -12,16 +12,44 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -63,16 +63,16 @@
 l.List;%0A
-
 %0A/**%0A * 
@@ -218,336 +218,590 @@
     
-// TODO%0A        return null;
+int%5B%5D%5B%5D counts = new int%5BA.length%5D%5B26%5D;%0A        for (int i = 0; i %3C A.length; i++) %7B
 %0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1002 prob = new Problem1002();%0A        System.out.println(prob.commonChars(new String%5B%5D%7B%22bella%22, %22label%22, %22roller%22%7D)); // %5B%22e%22,%22l%22,%22l%22%5D%0A        System.out.println(prob.commonChars(new String%5B%5D%7B%22cool%22, %22lock%22, %22cook%22%7D)); // %5B%22c%22,%22o%22%5D
+    for (int j = 0; j %3C A%5Bi%5D.length(); j++) %7B%0A                counts%5Bi%5D%5BA%5Bi%5D.charAt(j) - 'a'%5D++;%0A            %7D%0A        %7D%0A        List%3CString%3E answer = new ArrayList%3C%3E();%0A        for (char c = 'a'; c %3C= 'z'; c++) %7B%0A            int min = Integer.MAX_VALUE;%0A            for (int%5B%5D count : counts) %7B%0A                min = Math.min(min, count%5Bc - 'a'%5D);%0A            %7D%0A            for (int i = 0; i %3C min; i++) %7B%0A                answer.add(%22%22 + c);%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1002