public static String longestCommonPrefix(String[] strs) {
        String shortest = "";
        if (strs == null || strs.length == 0) {
            return shortest;
        }

        shortest = strs[0];
        for (int i = 1; i < strs.length; i++) {
            StringBuilder sBuilder = new StringBuilder();

            int k = 0;
            while (k < shortest.length() && k < strs[i].length()) {
                if (shortest.charAt(k) == strs[i].charAt(k)) {
                    sBuilder.append(shortest.charAt(k));
                    k ++;
                } else {
                    break;
                }
            }

            shortest = sBuilder.toString();
        }

        return shortest;
    }