Deepest shared path
Two services report their working directories as absolute Unix-style paths (they start with '/' and contain segments separated by single slashes, e.g. '/home/dev/app'). Return the deepest path both share, comparing whole segments — '/x/y' and '/x/yy' share only '/x', not '/x/y'. Return '/' when nothing beyond the root is shared. For example, '/home/dev/app/logs' and '/home/dev/api' share '/home/dev'.
Implement
common_path(a: str, b: str) → strExamples
in
["/home/dev/app/logs","/home/dev/api"]out"/home/dev"What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 15 min
solution.py
InputExpectedGot
["/home/dev/app/logs","/home/dev/api"]"/home/dev"not run yetsample