@@ -0,0 +1,1057 @@
+package leetcode;%0A%0Apublic class Task14 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(new Task14().longestCommonPrefix(new String%5B%5D%7B%22a%22%7D));%0A        System.out.println(new Task14().longestCommonPrefix(new String%5B%5D%7B%22flower%22, %22flow%22, %22flight%22%7D));%0A        System.out.println(new Task14().longestCommonPrefix(new String%5B%5D%7B%22dog%22, %22racer%22, %22car%22%7D));%0A        System.out.println(new Task14().longestCommonPrefix(new String%5B%5D%7B%22apba%22, %22ap%22%7D));%0A        System.out.println(new Task14().longestCommonPrefix(new String%5B%5D%7B%7D));%0A    %7D%0A%0A    public String longestCommonPrefix(String%5B%5D strs) %7B%0A        String first = strs.length %3E 0 ? strs%5B0%5D : %22%22;%0A        String longestPrefix = %22%22;%0A        for (int i = 1; i %3C= first.length(); i++) %7B%0A            String prefix = first.substring(0, i);%0A            for (int j = 1; j %3C strs.length; j++) %7B%0A                if (!strs%5Bj%5D.startsWith(prefix)) %7B%0A                    return longestPrefix;%0A                %7D%0A            %7D%0A            longestPrefix = prefix;%0A        %7D%0A        return longestPrefix;%0A    %7D%0A%0A%7D%0A%0A

Add Task14