Google Phone Screen Interview
Anonymous User
2936

Phone Screen :

  • Minimalistic IDE : This was given for the interview
  • I opted my language as Java
  • Problem statement was mentioned verbally
    • EntityID = int
      Entity = {
      type : ‘file’ | ‘directory’
      name : String
      Children : Collections of files/directory
      Size : int

      }

  • Calculate the size of entity ID which has been given
  • FileSystem : HashMap<EntityID, Entity>
  • Example :
root (ID : 2) :
		dir (ID : 1) :
				file (ID : 3 ) : size = 200b
				file (ID : 4 ) : size = 100b
		file (ID : 5) : size = 300b
So here the size of entityId=2 which is root is (200 + 100 + 300) which is 600b

FileSystem : HashMap<EntityID, Entity>

FileSystem : { 1 : {type='dir', name='dir', children=[1,5]},
					  2 : {type='dir', name='root', children=[3,4]},
					  3 : {type='file', name='file', size=200b},
					  4 : {type='file', name='file', size=100b},
					  5 : {type='file', name='file', size=300b}}
  • Follow up :
    • If the data is static where would you store it ?
    • What if the file size if in GB ?
    • How would you handle for directory case ? (children might have file or dir)
  • Final Verdict : Rejected

I was able to solve this and was able to give answer for the follow ups as well. But I don't know what went wrong.
Feedback was given as borderline in some areas and good in some areas.

Do upvote if you find this information useful :-)

Comments (10)