← ALL NOTES
Array

14. Longest Common Prefix

The common prefix of the whole array can't be longer than the common prefix of any two of its strings. So take the first string as a candidate and keep trimming it against each of the others — the…

Loading…