Facebook Onsite | Menlo Park | 7+ YOE

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-06-25Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e5
Interview Stage: Onsite
Location: Menlo Park
Year: unknown

Original Post Content:

So, I interviewed with Facebook yesterday through a virtual onsite. The questions were pretty much same from LC tagged but there was this question that catches my mind.
It looks similar to https://leetcode.com/problems/find-duplicate-file-in-system/ but here we don't have content of file to match, we need to return the list of paths which are non-redundant. A path is redundant if it's root already present in the list.

Example 1:
Input = ["/a/b/c","/a/b","/d/e","/d"]
Expected output = ["/a/b" , "/d"]

Example 2:
Input = ["/a/b/d","/a/b/f","/d/e","/d"]
Expected output = ['/a/b/d', '/a/b/f', '/d']

I tried asking my interviewer, like how we define root here is it just one directory after first '/', but he didn't utter a single word.

Can someone help me with this one ?

Comments