- System design, whiteboard and youtube, ~1hr each. Mostly from Naren’s channel.
- Uber. Path planning. Websockets to keep gps locations updated every few seconds.
- Fandango. All booking sites are comparable (airbnb etc) where you find a match. Suggestions are an important piece here (netflix etc), use heuristics from previous content.
- Webcrawler. Probably the most different one. Follow links, basically just a gigantic 100b node graph. Use a bloom filter for the “in visited?” portion. Used for search engines, copyright police, more.
- Twitter. Social media, read-heavy. Precompute feeds on write for most users. For celebrities, read on call.
- Whatsapp. Any chat service. XMPP, or websockets as the persistent protocol to read-write with new messages. And session, for delivered/read receipts. Message queue for the actual text, before db.
- Google docs.
- Dropbox/gdrive/stash. Just remote file representation, upload/download/sync. History is the most important piece here. Store diffs, not copies. Chunk files so you can diff efficiently.
- Gdocs. Collaborative editing. Just like optimistic locks. Like the previous, chunk for differential syncing. Could be character by character, or batched in whole lines, etc. This is called operational transformation, everything is captured in an event (insert, delete, update…) and replayed for all other clients. Or you could just do raw diffs (patches) and try to apply, raising conflict if need be.
- Curated list of interesting stuff: https://github.com/sindresorhus/awesome.
- Watched the ted interview with jim simons: https://www.youtube.com/watch?v=U5kIdtMJGc8. Not a ton of info.
- Subscribed to https://eng.uber.com/.
- Went through a bit of https://github.com/yangshun/tech-interview-handbook.
- Spoke with fb to schedule the coding interview, asap today or tomorrow morning before flight. Talked about instagram and whatsapp team matching. She was actually chicago based and mentioned citadel!
- Later in the day we scheduled for tomorrow morning before the flight to Chicago.
- Quick call with citadel for Thurs prep. The importance of tech in finance, and how that’s reflecting in recent numbers (vs companies married to legacy finance fundamentals).
- Practiced a few behavioral orations again.
- Run, core, sauna, stretch, meditate.
- Another amazon feedback survey. Good all around.
- Watched a few videos on vocal coaching, remembering that breath class I took at stanford and how powerful of a speaker the professor was. Some were more focused toward singing, some toward presenting. Do mouth/face/voice warmups, stretch, posture, confidence, smile; treat it like a conversation not a stage.
- XMPP is very similar in functionality to websockets. Persistent connection, peer-peer. XMPP is decentralized, can be distributed; websockets are centralized.
- TCP is more reliable than UDP. It establishes a connection/handshake. UDP just sends data. Faster, but could be lossy.
- The python logo is 2 snakes curled into a cross, just to represent the snake name.
- Python isnum, isalpha, isalnum.
- Problems:
- https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/. Same as the usual level-order traversal (do iteratively, keep children), but keep a boolean that you swap each time for the direction of level printout.
- https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree. Interesting new class of problem for me. Rather than converting a tree into a list via traversal, you’re given the traversal lists and you have to create a possible tree (there are many valid ones).
- https://leetcode.com/problems/pascals-triangle/. Recursion. Add above two numbers.
- https://leetcode.com/problems/populating-next-right-pointers-in-each-node/. Cool problem, another level-order traversal, just a slight constant-mem twist.
- https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/. A bit harder. Still recurse the traversal lists to create the nodes, but you have to think a bit more deeply. Use the preorder array to grab the root, find the root in the inorder array to bisect it, then get the lengths of both halves. Use that to split the remainder of the preorder array. Then just recurse as usual.
- https://leetcode.com/problems/binary-tree-maximum-path-sum. Use a postorder traversal. Recurse left right, calculating the max for those child nodes, then calc the max for this node by simply adding its val.
- https://leetcode.com/problems/valid-palindrome. Easy. Just compare palindrome fwd and rev.
- https://leetcode.com/problems/word-ladder/. Interesting problem. Jumping through available words, only allowing one letter change at a time. It’s a graph problem, but takes a minute to realize this. I had first leaned toward a Trie. Once you realized graph, just build it and run BFS for the shortest path.
- https://leetcode.com/problems/surrounded-regions/. Used DFS to find the unsurrounded nodes from the edge, then simply moved everything other than that to X. Uses nodes for this one (not paths), which I haven’t done in a while. It’s simpler.
- Reread https://github.com/donnemartin/system-design-primer. Great document.
- Remember to always popleft() with doing DFS or BFS. It’s just for BFS, append to end. For DFS, appendleft().