Tech Screen
Question 1: Range Sum of a Binary Tree
I clarified the requirements upfront, discussing multiple approaches and getting buy-in from the interviewer. I also proposed test cases and edge cases to consider
The question went smoothly. The interviewers appreciated my clarifying questions (e.g., whether the tree was a binary tree or a binary search tree, and how to handle an empty tree). After agreeing on an approach, I coded it up quickly and walked through a test case. I also discussed the time complexity but almost tripped up—I initially said 𝑂(log𝑁) , but I caught myself and clarified that the worst-case complexity is actually
O(N) if all nodes fall within the given range ( Only caught this cos he asked)
Question 2: Kth Largest Element in an Array
I started by discussing the naive approach of sorting the array and returning the kth largest element, explaining why it's inefficient. I then introduced the heap-based solution and its complexity. The interviewer asked if we could do better, so I explained Quickselect, how it works, and its average and worst-case time complexity. The interviewer seemed pleased and asked me to code the heap solution. I implemented it quickly and began walking through a test case when I realized an issue: when k=0, the largest element should be returned. I was momentarily confused but kept verbalizing my thought process. The interviewer prompted me to consider what happens when k=0,1,2,3, which helped me recognize that I needed to adjust the index by adding an offset (k+1 largest). I fixed the code, and the interviewer said it looked good. We ran out of time before fully walking through all test cases.
Virtual Onsite ( All rounds same day back to back)
Coding 1
Q1 - Max consecutive ones variant. Instead of a binary array input is "W" and "H" and question is to optimize the length of the continuous time off given a PTO limit as input.
Clarified questions and discussed sliding window implementation. Talked about the time and space complexity and asked about edge cases. Coded this up quickly and started walking through a test case. The sample test case interviewer provided was kinda long ( 7 indices I think) Had to go through each line and updated the variables with their current state. Caught a bug during this and fixed it ( think using == instead of <). Interviewer said asll looked good and we moved to next question
Q2 - Similar to maximum profit question but with airline tickets. Was explaining the approach and got tripped as I figured I'd have to keep a minimum of the return ticket while interating ( I realized this was wrong and explained that I can't buy a return ticket before a departure one) Interviewer said correct so how do I approach this. This was a really easy question and I was somehow tripped and overcomplicated it. I was constantly talking and verbalizing my thoughts but I think we had like 8 minutes left and he said to just code what I was explaining. Ended up coding a solution that worked but used extra space unnecessarily and was mentally defeated. (piece of advice, treat each round as a black box and try not to thinkk about it in other rounds as it may affect your performance)
Coding 2
Q1 Evaluate a^b without any function.
I absolutely killed this question. Clarifying questions, time and space complexity, test cases to cover all 4 possible cases. Coded it up and ran through two testcases. The second test case had a large power so took time going over all iterations. Absolutely killed this question
Q2 Moving median in an array. This one cuaght me by surprise and I was thinking of how I'd approach it while verbalizing my thoughts. I proposed a sliding window approach and said I'd somehow figure out a way to sort the elements in each window as that's how I'd get the median. Interviewer interjected and said no sorting - I think he was trying to give hints but I had a hard time understanding him. While I could have solved this, just thinking about my mistake in the first round and with this question made things worse. Eventually decided to create a helper function and abstracted away finding the median and then main function to cover iterating through and passing of the right window slice. Talked about the complexity of that and then he asked how I would implement the helper function - I couldn't immediately think of a way without sorting ( was thinking quickselect since we know the size of the window and can get middle element if we used it's index as the pivot) but even I knew this was overreaching and over complicating it. He then said we could use two heaps ( min and max) and exlained how it'll work.
He was a tough interviewer I must say and we had communication issues but this is all a game of luck so I guess better luck next time.
**System Design - **
Asked to Design a social media neews feed. This went really well and followd hello interview format. I kept cool and just talked through and sometimes paused to ask questions and discussed tradeoffs. Was trying to maintain my cool but couldn't stop thinking about the mistakes I made in the coding rounds. I think this round went better than I expected as I only studied for a short time but made sure to understand the different tech and how and where to use them. Interviewer seems pleased and was able to answer his follow ups. I practically drove the discussion
Behavioral
This went well and interviewer and I had a really nice chat and even went past time ( not that this would be an indication of my performance but rather that we had a nice discussion)
Shout out to coding with Minmer - Hopefully we make it next time around !