Google phone screen
Anonymous User
8855

first question: given a file directory as a string in following way, print the path as a tree.

input: /a/b/c

output:
a
-b
--c
'-' corresponds to a tab

question 2: given a list of strings, having same format as question 1. Now print the whole file structure. if there are multiple files or directories in a directory, then order them based on the order in the input.

input:
'/a/c/ac', 'a/b/ab', 'b/c/bc', 'a/c/ac2'

output:
a
-c
--ac
--ac2
-b
--ab
b
-c
--bc

Interview result: I passed this round. And recently finished onsite too.

To get more about interview experience, coding and cloud in general please follow me on medium https://shadek07.medium.com/

Comments (27)