is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
File system is basically a tree. So your root node is your root folder. Each folder needs to be have map with name of the subdirectories.
- sp786 November 20, 2016Since we change directories we need to keep reference to current directory and have ability to traverse to its parent for 'up' command.
So directory can be represented as a class with reference to its parent object (parent will be null for the root) and its map of sub directories.
Command that needs to be handled:
dir -> print element of current node's map
mkdir -> create element in map. Entry in the map should be object of class node and should have reference to current node as a parent.
if map already contains that entry with the key -> subdirectory already exists
cd -> change current node value
Find entry in map of current with name of directory you want to cd into.
if map doesn't contain entry with that name -> subdirectory doesn't exist.
if exists then change current node
up -> change current node value
Check if parent reference is null
if null -> cannot move up the root directory
else change current node to its parent.