- Suppose you are given two numbers represented by a list of their prime factors and the power (e.g. 2520 = 23 × 32 × 5 × 7, and 2772 = 22 × 32 × 7 × 11),
- Determine what is a good representation of numbers as prime factors; and
- Write the gcd (greatest common denominator) and lcm (least common multiplier) for two arbitrary numbers.
- Suppose I give you a function (predicate) that takes an integer and tells you whether the number is smaller than or equal to some integer constant only the function knows about. You can assume the hidden constant is an integer greater than or equal to 0. Write a function that tries to guess the hidden integer (hint: use binary search, but watch out for subtle corner cases).
Wednesday, September 3, 2008
Here are some of the programming interview questions that I came up with. These are not questions from someone else. Their similarity to existing questions are purely coincidental.