### Question:
LongestCommonPrefix { public String longestCommonPrefix(String[] strs) { StringBuilder result = new StringBuilder(); int length = Integer.MAX_VALUE; for (String str : strs) { length = Math.min(length, str.length()); } for (int i = 0; i < length; i++) { char tmp = ' '; for (String str : strs) { if( tmp == ' '){ tmp = str.charAt(i); }else{ if(tmp != str.charAt(i)){ tmp = ' '; break; } } } if( tmp == ' '){ break; } result.append(tmp); } return result.toString(); }  String longestCommonPrefix(String[] strs);  }### Answer:
@Test void go() { LongestCommonPrefix obj = new LongestCommonPrefix(); String[] strs = new String[]{"flower","flow","flight"}; assertEquals(obj.longestCommonPrefix(strs),"fl"); }