Home > Reflections | ⏮️ ⏭️
2024-06-17
🏋️ Practice / Warm Up
1662. Check If Two String Arrays are Equivalent
Given two string arrays
word1
andword2
, returntrue
if the two arrays represent the same string, andfalse
otherwise.
A string is represented by an array if the array elements concatenated in order forms the string.
Reflections
- The first implementation pass went really well, finishing everything in under 8 minutes
- Trying the harder implementation
- My first implementation didn’t work
- But I caught the bug during my own manual testing
- My first attempt to fix it wasn’t fruitful
- But eventually, I abandoned that path and my second attempt to fix worked
- 36 minutes isn’t great, but this was the harder implementation and I did eventually get a working solution, so I think it’s good enough
My Solutions
Day-of Interview Preparation
- I got to bed early last night and slept well.
- I had breakfast, practiced a bit in the morning, ran, had a short nap, and a cold shower… I did everything I wanted to do in prep.
- I felt good coming into the interview.
The Interview
There weren’t any surprises in the format of the interview.
15 minutes of behavioral questions, about 40 minutes of coding and about 5 minutes of my questions for my interviewer.
Behavioral Questions
- Tell me about a time when you had a cross-functional conflict between teams.
- Tell me about a time when you collaborated cross-functionally to solve a business problem.
For both of these questions, he asked me to be more specific multiple times.
I think my answers qualified, but I don’t think my interviewer was particularly impressed with them.
Maybe I should put more time into writing more detailed stories to field a broader spectrum of behavioral questions.
Coding Question
- Whew - that was intense.
- This felt like a weird looking tree problem, but perhaps that means that I just haven’t spent enough time practicing tree problems.
- Note: this problem is very similar to LeetCode’s 199. Binary Tree Right Side View, but I was asked for both sides.
- In my planning phase, I identified an approach of turning the tree into levels, then processing those levels.
- During the coding phase
- ✅ I started with a top down implementation
- ✅ I did not immediately implement the one helper function I posited
- ✅ I asked my interviewer if he wanted to see the implementation of the helper function first or a test of the top level function (he said to finish implementing the code)
- ✅ I identified recursion as probably a good approach before starting, since I was working with a recursive data structure (a tree)
- 😬 My first attempt at implementing this levelsFromTree function recursively did not go well. I spent some time with it, but it didn’t feel right. I tried fixing it, but still didn’t make progress.
- ✅ Eventually, I thought: rather than be stuck down this path that doesn’t look promising, can I think of a different way to do this?
- ✅ I somehow came up with a different recursive approach that seemed more likely to produce a correct result
- ✅ I implemented this second approach without too much trouble, then asked if he’d like to see a test.
- 😬 He asked if I thought I was done coding.
- ✅ Which I took as a cue to review my code for obvious missing pieces
- ✅ The recursive helper function looked correct, but when reviewing the high level implementation, I realized that it was now incorrect due to pivoting the implementation of the helper function.
- ✅ I fixed up the top level function until it looked correct given the new helper
- ✅ I told my interviewer that I thought it was now complete, given a correct implementation of my recursive helper function.
- ✅ He asked me to test the code, so I chose the more challenging looking example input he’d provided initially.
- ✅ I used my well-practiced manual testing strategy, annotating important variable state in-line where variables are declared.
- ⌛ It took a while to test my recursive helper function, but I worked through it one step at a time, and the results looked good.
- ✅ I didn’t find any bugs in the recursive helper function, but I did find and fix a small bug in the top level implementation while finishing my test case.
- 😬 After finishing my test case, I felt pretty good about the implementation, and I felt like a lot of time had passed.
- 😬 Perhaps I should have tried another test case with the time we had left.
- 😬 Perhaps I should made some remarks about the code quality at this point.
- 🤷 But instead, I felt like I was probably about out of time, so said I thought I was done and asked how he felt about it.
- 🆗 He said okay and moved on to invite me to ask him questions.
- ❔ I asked him 2 questions, the latter of which he said was a good question.
- I felt like I was making these questions up on the fly, and really should have written out example questions to ask before my interview.
- On the other hand, I could also feel the residual stress hormones pulsing through my body, and I think I did a pretty decent job of holding it together to ask decent questions.
- My first question related his personal experience (which I’d noted during his intro) to recent developments at the company (which I’d learned about by studying the week prior). He answered my question, but didn’t seem too engaged by it.
- My second question attempted to reveal some details about leadership and autonomy within company culture. My first phrasing of the question elicited a “can you be more specific?” After refining my question, he remarked that it was a good question and answered it reasonably.
- After my second question, time was about up, so I thanked him for his time and we ended the interview.
- How do I feel about this?
- I need to do a better job preparing for behavioral questions and (less importantly) for questions that I’ll ask my interviewers.
- I feel like I probably struggled more than I should have with this coding problem.
- I really hope he didn’t intend for us to do 2 questions, because we only attempted 1. I’m pretty sure there wasn’t a second problem planned…
- But assuming it was only intended to be a single question interview, I feel good enough about having come up with a complete solution that seemed like it would work.
- Overall, I think I probably did well enough to move on to the next round. That said, I expect them to dig into some weaknesses displayed in this first interview. I have homework to do.