Skip to main content

Sample questions for technical interviews

Warning

Trainees - if you're going to attend the technical interview workshop please don't read this page - it contains hints that will spoil the learning experience for you.

Roman numerals

The Romans used a different number-writing system than we do.

They had some basic numbers:

  • I is 1
  • V is 5
  • X is 10

And to write a number that doesn't have its own symbol, they wrote down numbers that add up to it, in descending order.

For instance, to represent 12, they would write XII.

However, to avoid writing down lots of numbers, they didn't write 4 as IIII, they wrote it as IV (as in, "one less than five").

Your task is to write a function which takes a Roman numeral, and returns the integer it represents.

Hints

  • Some interviewees don't realise that they only need to do a single character of look-ahead when determining whether a number is being subtracted from the following number or not. If they seem stuck on this, give them some examples to nudge them at the idea.

Longest common prefix

Given an array of strings, return the longest substring that all of the strings start with.

TODO: Write up more interview questions, and more guidance for asking them.