Navigating the Challenges of Job Interviews in Tech
Written on
Understanding the Technical Interview Process
In a recent interview experience on March 28, 2023, I faced a challenging question that revolved around the File System. The task involved constructing a file system from an array of file paths. Unfortunately, I overlooked a fundamental aspect of the problem, which cost me the opportunity to successfully solve it. The interviewer was gracious and mentioned that he had also struggled with a similar question during his own Google interview, which I found hard to comprehend. His suggestion to relax and get some rest post-interview was appreciated, but I still felt disheartened by my performance.
The question, while not straightforward, was certainly manageable with the right approach. I had a few potential solutions in mind but was unable to articulate them during the interview.
Lessons from My Interview Journey
Every interview provides a valuable learning opportunity, often more effective than simply reading articles. I always look forward to engaging interviews that present intriguing questions. Four years ago, I faced rejection from 42 companies in just one month due to my lack of programming knowledge. Now, I view interviews as a means to assess my understanding and discover new insights.
Let me share a memorable experience from my interview journey. In June 2022, I had a conversation with a co-founder of a US startup with 15 years of experience. What was supposed to be a 45-minute interview extended to three hours, evolving into a deep discussion about startups, ideas, and technology rather than a standard interview format.
Although I was ultimately not selected, this interaction significantly influenced my thinking. The founder encouraged me to refine my project, iHateReading, and focus on niche solutions that add value to users. It was a unique experience that transcended a typical interview, transforming it into a mentoring session that motivated me to invest more in my business.
As I often say, interviews should foster discussions and explore thought processes. With tools like ChatGPT capable of coding, what truly differentiates a developer is creativity and the ability to approach problems from various angles.
Tackling the Interview Question
The interview question presented was straightforward: given the following array of file paths, the task was to build a corresponding file system.
const files = [
"/usr/lib/keytool",
"/usr/libr/bash_profile",
"/Downloads/shrey.txt",
];
The solution involves constructing a JSON representation by iterating over the file paths as follows:
const root = {
"": {
"usr": {
"lib": {
"keytool": {}}
}
}
}
Since "keytool" represents a file, it should contain content rather than being an object. By splitting the paths into directories and using a pointer to navigate through the structure, we can effectively build the file system.
const root = {};
for (let i = 0; i < files.length; i++) {
let itr = root;
const directories = files[i].split("/");
directories.forEach(item => {
itr[item] = itr[item] || {};
itr = itr[item];
});
}
console.log(root);
Regrettably, I stumbled on the pointer management, where I needed to assign itr to the current directory and correctly navigate through the hierarchy. While I felt disappointed in my inability to solve the problem, the interviewer reassured me that he too had encountered difficulties with this question in the past.
Reality Check: Embracing Challenges
Interviews serve as crucial reality checks. They highlight areas where our knowledge may fall short. While we can prepare for numerous topics, unexpected questions can still arise, as I experienced with the file system question. This experience prompted me to delve deeper into pointers, references, and JSON iterations, aiming to enhance my problem-solving capabilities using solid data structure principles.
Ultimately, we must acknowledge our mistakes, learn from them, and continue to progress. I have another interview on the horizon, and while it will surely present a different set of challenges, I remain hopeful for a positive outcome.
Conclusion
For those seeking new opportunities, I've compiled a template to help streamline the job hunting process. Additionally, here's a list of platforms to explore for your next career move. Until next time, take care, and don't forget to subscribe!
Exploring Google's Coding Interview Question
In the first video, titled "Google Coding Interview Question | Leetcode 588 | Design In-Memory File System," the presenter dives into a coding challenge that closely resembles the question discussed above. This video offers insights on how to approach such problems during interviews and provides valuable coding strategies.
A Beginner's Guide to the File System Module in Node.js
The second video, "A Beginner's Guide To The File System Module In Node.js," serves as an excellent resource for understanding file systems in JavaScript. It covers key concepts and practical applications of the file system module, which can be beneficial for interviews and real-world coding scenarios.