Remix.run Logo
vecter 5 hours ago

I interviewed for an internship in 2006 and didn't get any brainteasers, but I got some pretty interesting questions that were somewhat computer science-related:

1. Suppose you have a binary tree (NOT a binary search tree) where each node with pointers to its parent and children. Given pointers to two arbitrary nodes in the tree, find their lowest common ancestor.

2. My favorite: given a uniform random number generator mod 5, create a uniform random number generator mod 7

3. Forgot the exact question, but something along the lines of: suppose you want to keep track of function arguments as you call them. How do you do that?

I got (1) and (2) and utterly failed (3). (3) is entirely trivial and basically a stated fact if you know how anything about how operating systems work, but I was a freshman in college and didn't know that function arguments got pushed on a stack in memory, so I was totally lost.