using System; using System.Collections.Generic; using System.Linq; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param strs string字符串一维数组 * @return string字符串 */ public string longestCommonPrefix (List<string> strs) => strs.Count == 0 ? "" : strs.Aggregate((total, next) => string.Concat(total.TakeWhile((c, i) => i < next.Length && c == next[i]))); }