Longest Common Prefix

Programming Interview Medium 5 views
Back to Questions

Problem Description

Given {x}, Output their longest common prefix. If no common prefix, output EMPTY.

Input Format

First line n. Next n lines strings.

Output Format

One line prefix or EMPTY.

Sample Test Case

Input:
3 flower flow flight
Output:
fl

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next