Longest Common Prefix

An algorithm for finding the longest common prefix among a set of strings.

  • Time complexity is Linear, i.e. O(n)
  • Space complexity is Constant, i.e. O(1)