When your commonPrefix takes 2 paths, length of both paths are n and both paths 
has no common prefix, it has O(n^2) time complexity. Because startsWith proc is 
O(n) and it is called n times.

relativePath proc in os module calculate common prefix in O(n) time complexity. 
[https://github.com/nim-lang/Nim/blob/devel/lib/pure/os.nim](https://github.com/nim-lang/Nim/blob/devel/lib/pure/os.nim)

Reply via email to