deno.land / x / masx200_leetcode_test@10.6.5 / longest-common-prefix / index.ts
1234567891011121314export default function longestCommonPrefix(strs: string[]): string { let ret = ""; const len = Math.min(...strs.map((s) => s.length)); for (let i = 0; i < len; i++) { for (const s of strs) { if (s[i] !== strs[0][i]) { return ret; } } ret += strs[0][i]; } return ret;}
Version Info