Home > Reflections | ⏮️ ⏭️
2024-06-15
🧠 Education
🧰 Tools to Enhance Working Memory & Attention
🔮 Planning for my upcoming interview
Planning for Everything proposes the STAR FINDER framework.
Make planning more…
- 👥 Social
- 📈 Tangible
- 🐿️ Agile
- 🪞 Reflective
… through …
- 🖼️ Framing
- 💭 Imagining
- ✂️ Narrowing
- 👩⚖️ Deciding
- ⛹🏻 Executing
- 🪞 Reflecting
🖼️ Framing
- I have my first interview on Monday
- The role I’m apply for represents a step up on my career track
- I’ve been practicing for a couple of months
- The interview agenda
- A behavioral question
- 2 coding questions
- An opportunity for me to ask questions
💭 Imagining
1. Before my interview, I’ve prepared my mind, body, and environment for calm, focused, optimal performance.
- I slept well.
- I ate well
- breakfast and lunch
- Not too heavy
- Fiber → protein & fats → carbs
- If tired, I took a ~20 minute nappuccino+++
- Coffee → nap → cold exposure → bright light → exercise
- Aerobic exercise: ideally I’ve gone for a run.
- Hot, then cold shower.
- My office is clean, orderly, bright, and prepared.
- My headphones are charged and connected.
- I’m logged in to the zoom call and coderpad at least 5 minutes early.
- I can close my window or door as necessary to dampen distracting noises.
- I can choose noise canceling headphones if necessary.
- I have blank paper and pen ready for notes.
- I have coffee and water.
- The cats are quiet and distracted somewhere else in the house.
- I’m calm and in a good mood.
2. In the ideal interview
-
I answer a behavioral question with a concise, specific, relevant story, demonstrating, technical expertise, leadership, and good judgement in a context with broad scope.
-
I demonstrate effective problem solving, coding, communication, and verification skills on one or two coding problems.
- Planning (problem solving)
2. I first demonstrate an understanding of the problem by paraphrasing, asking clarifying questions, and illustrating examples
3. Next, I consider multiple approaches to solving the given problem
1. I might start with an obvious, brute force approach
2. Then I may search for insights, data structures, and algorithms that support a more efficient solution
3. Is recursion a good fit? (And is my interviewer comfortable with a recursive solution?)
4. Are there any obvious data structures or algorithms that come to mind?
5. How can I reduce the search space?
6. How can known properties of correct results inform my search?
4. I identify the runtime and extra space complexity implied by each approach
5. I consider trade offs
6. And I seek agreement or hesitation from my interviewer
7. If I can’t identify a satisfactory solution, I explain my situation and ask for guidance from my interviewer
8. I carefully consider any feedback or hints they provide and incorporate them into my strategy - Coding
- I should start with a top down approach
- Focus on the core of the solution
- Don’t implement helper functions in advance (or at all if my interviewer doesn’t ask me to)
- Move quickly, but carefully, taking time to use good variable names and patterns
- If stuck in the details, I can
- Simulate the algorithm working with example inputs
- Clearly state or write the point I’m focused on, and what exactly I’m stuck on
- Consider declaring a few moments of radio silence while I work out the details in my head
- When I’ve finished the top level function, I should ask my interviewer if they’re ready for me to test my solution, or if they’d like to see something more first (e.g. implementing a nontrivial helper function)
- Testing
- Choose an example input with high code coverage
- Walk through the code line by line, annotating critical variables with in-line comments succinctly describing state
- Be sure to mentally simulate each line of code and not just write what each value should be.
- Assume I’ll find bugs - I almost always do.
- Describe the bugs I find, making quick fixes when appropriate
- Keep an eye out for common kinds of bugs
- Logic errors
- Unhandled cases
- Off by 1 errors
>
vs>=
- Null pointer dereferencing
- Using wrong variable names
- Type errors (e.g. using an array instead of its length)
- Infinite loops
- Missing base cases in recursive functions
- Communication (throughout)
- Ask clarifying questions
- Occasionally check that the interviewer is following
- Demonstrate understanding with examples
- Narrate my thought process, but don’t be too verbose
- Use good variable names
- Describe and document obscure tricks, language features, and helper functions
- Pay careful attention to tips, hints, or questions my interviewer asks: they’re trying to help
- At the end, analyze my own code, commenting on what I like and don’t like about it. Would I approve this in a code review? What compromises or trade offs have we made?
- Planning (problem solving)
-
I ask good, strategic questions when invited.
-
People love talking about themselves. Consider asking about my interviewer.
-
Is there anything I can ask this interviewer that can help me in later interviews?
-
Demonstrate my sincerity and enthusiasm for joining the company with thoughtful questions about culture, structure, or expectations.
✂️ Narrowing
- I don’t have much time left to prepare
- But I’ve covered a lot over the past weeks and months
- What gaps stand out in my mind?
- What’s the best use of my remaining time?
👩⚖️ Deciding
- I’ll aim to interleave
- Practicing coding problems
- end-to-end
- keeping an eye on timing
- and reviewing my work when it takes too long
- looking for different ways to solve the same problem faster
- and looking for patterns in successful and failure paths
- Implementing some basics and classic algorithms and data structures
- Writing more stories for behavioral questions
- Practicing coding problems
- With so little time before game day, I’m not likely to dramatically improve my performance at this point, so I’ll focus on fine tuning, moderation, and physical and psychological preparation
🏃 Executing
✍🏻 See below.
🪞 Reflecting
🔜 Coming soon.
🏋️ Practice
58. Length of Last Word
Given a string
s
consisting of words and spaces, return the length of the last word in the string.
A word is a maximal substring consisting of non-space characters only.
🪞 Reflections
- even in easy problems, managing state is complicated and error prone (2nd implementation)
- annotating the index variable i during testing was a waste of time
- annotating true and false during testing could have been shortened to T | F
- I’m not super confident in regex special character notation (e.g. \s for white space… or is it \S … \w is for words or white space?)
- In the 2nd implementation, the test input was a bit unnecessarily complicated, e.g. didn’t need all the extra white space
- timing was still great for both of these implementations, ~9 & ~13 minutes respectively
- that said, this was a very easy problem
- initial planning was probably too detailed and took too long for this simple of a problem
My Solutions
2956. Find Common Elements Between Two Arrays
You are given two integer arrays
nums1
andnums2
of sizesn
andm
, respectively. Calculate the following values:
answer1
: the number of indicesi
such thatnums1[i]
exists innums2
.answer2
: the number of indicesi
such thatnums2[i]
exists innums1
.
Return[answer1,answer2]
.
🪞 Reflections
- Planning went well, though maybe a bit long for this problem (5:32)
- Implementation was fast and correct on first try
- Testing was fine
- Overall time was satisfactory: 11 minutes (15 minute target)
- Even implementing the more complicated version with sorting, there was only the one bug due to JavaScript’s default sorting (though time was a bit long at 21 minutes)