Loading...

Common Prefix

A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
hard

Problem

We need the shared path prefix across a set of S3 keys to identify the common directory root. Return the longest string that is a prefix of every string in the list. Return an empty string if there is no common prefix.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.