Common Prefix
A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L4
Problem
Given a list of strings, return the longest string that is a prefix of every string. Return empty string if there is no common prefix or the list is empty.
Summary
They all start the same way. How far?
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.