Kevin practices code interviews
I’m interested in the challenge of code interviews. Not the challenge of defeating some gatekeeper or demonstrating mastery of technical trivia, but rather speaking off the cuff: The challenge of calmly (and coherently) narrating my own thoughts while solving an unfamiliar problem.
This page catalogs my attempts to improve the following:
- signposting (“this is what I’m about to do, and here’s why; this is what I just did”)
- articulating a hypothesis before every code execution
- speaking without filler words (“so”, “um”, “you know”, etc.)
- typing without tics (e.g., unnecessary scrolling / cursor movement)
Since I’ve never studied computer science at university or written much C, problems from that domain should be perfect for practicing being lost and confused. Most of the problems below have been drawn from Cracking the Coding Interview.
I had a cold today, so I stayed home and recorded a ton of practice sessions!
Problem 5.6, flipping pairs of bits. Ran into trouble w/ clang, skip to 14m to see actual problem. Said “you know” once.
A second take on the same problem.
I realized I should practice for loops from the top down, since they can lead to clearer code. Aside from typing too quickly / inaccurately, I’m pretty happy with how this video turned out
Brain teasers. Consequtive number summing trick is from Gauss, not Euler. On the jug problem, I failed to consider whether my solution was optimal in terms of the number of steps — I came to an 8 step solution. Not sure if there’s a better solution, but I should have mentioned the possibility.
Not coding practice, but a quick screencast I made for the Sketch.systems mailing list.
Setting up an experiment to answer a question about how inheritance works in Alloy, and how that relates to Statecharts.
Still saying “so” and “you know”; have a habit of clicking my tounge.
June 18 Sketch.systems update
A bit different than usual: A longer video about refactoring the Clojure backend of Sketch.systems.
After recording the video, I factored out a
get-pen-metadata function and memoized it (to avoid every sketch looking from calling github twice – first to get the unchanging owner name and id, and again to check the gist for updates).
file->raw-url function was updated to add a content-hash as query param to all returned URLs (to invalidate browser caches when the images associated with a state are changed.)
June 16 bit insertion problem 5.1
Still say “so” all the time = (
Good signposting. Seem to be typing more quickly than thinking — keep immediately correcting typing mistakes. Good job speaking out loud; pauses sound thoughtful / considered.
June 14 distinct linked list
June 12 print bits
Talking fast at the beginning, kept saying “okay, so”. Voice keeps ending on a high note, especially at the beginning when quickly typing out scaffold code.
Voice trails off while thinking, which underscores the unsureness — would be better to speak clearly and loudly and convey unsureness with words rather than tone.
3:00 Misread output as being correct, when it was actually incorrect; then botched the fix by typing “%ul” instead of “%lu”
Was inconsistent with the loops — the j started at the top, whereas the i started at the bottom. No reason for this, it’s confusing.
Probably should have tried
Would be helpful to pause every once in a while and reflect back on the steps that have been completed. (Especially at the end — discuss any possible issues with the proposed solution and give potential next steps.)
June 10 Popcount
speaking / presentation issues:
- lots of filler words: uh, ums, you knows.
- running too quickly through comments; they don’t make sense after the fact.
- not totally precise while speaking
thought that sizeof returned number of bits, though I did catch this while testing my function. It actually returns size in units of char, which has CHARBIT bits. (CHARBIT is defined in limits.h)
struggled to create a number with all bits set