@@ -0,0 +1,905 @@
+package leetcode;%0A%0A/**%0A * https://oj.leetcode.com/problems/longest-common-prefix/%0A */%0Apublic class Problem14 %7B%0A    public String longestCommonPrefix(String%5B%5D strs) %7B%0A        StringBuilder result = new StringBuilder();%0A        if (strs.length == 0) %7B%0A            return %22%22;%0A        %7D%0A        int i = 0;%0A        outer:%0A        while (true) %7B%0A            // scan vertically%0A            if (i %3E= strs%5B0%5D.length()) %7B%0A                break;%0A            %7D%0A            char tmp = strs%5B0%5D.charAt(i);%0A            for (int j = 1; j %3C strs.length; j++) %7B%0A                String s = strs%5Bj%5D;%0A                if (i %3E= s.length()) %7B%0A                    break outer;%0A                %7D%0A                char c = s.charAt(i);%0A                if (c != tmp) %7B%0A                    break outer;%0A                %7D%0A            %7D%0A            result.append(tmp);%0A            i++;%0A        %7D%0A        return result.toString();%0A    %7D%0A%7D%0A

Solve problem 14