Longest Common Sub Path

Problem

Given an input text file with format as in the following example:

print the number of sub directory levels that are common to all paths in the file. In this case it is /foo/bar/x so the count is 3

Solution

Here is a sample python code to implement that

Tags:

Add a Comment

Your email address will not be published. Required fields are marked *