Skip to main content

✏️ Whiteboard Practice

Whiteboard Practice


When and how whiteboarding practice is implemented will be up to your teacher. Below is a recommended prompt.

Goal

As the interviewee:

  • Ask clarifying questions.
  • Keep talking.
  • Explain your plan at the beginning; recap what you’ve done at the end.
  • Make eye contact.
  • Plan your space.

As the interviewer:

  • Answer questions as best as you can.
  • Be encouraging. Whiteboarding is difficult!
  • Be patient. Only offer hints if your partner indicates that they need help.
  • Be engaged. Part of this practice is getting used to having someone evaluate your work as your produce it.
  • Offer constructive feedback. Find at least one thing that your partner did well and one thing they could improve at.

Problem

1st Prompt: If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.

Write a method that given a number between 1 and 1000, returns the number of letters in the given number as a word.

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.

Examples:

  • Given: 7, Output: 5

  • Given: 24, Output: 10

2nd Prompt: Write a method that given 1 number, returns the sum of all of the square numbers up to that given number.

Examples:

  • Given: 20, Output: 30 (1 + 4 + 9 + 16)

  • Given: 30, Output: 55 (1 + 4 + 9 + 16 + 25)

Further Exploration

  • Write a method that given two numbers, returns the number of letters in the sum (as a word) of the 2 given numbers.

    • Examples:

      • Given: 7, 2 Output: 7

      • Given: 3, 24 Output: 13

  • Write a method that given 2 number, returns the sum of all of the square numbers in the range between the two given numbers.

    • Examples:

      • Given: 20, 30 Output: 25

      • Given: 15, 50 Output: 126 (16 + 25 + 36 + 49)