When and how whiteboarding practice is implemented will be up to your teacher. Below is a recommended prompt.
As the interviewee:
As the interviewer:
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.
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.
Given: 20, Output: 30 (1 + 4 + 9 + 16)
Given: 30, Output: 55 (1 + 4 + 9 + 16 + 25)
Write a method that given two numbers, returns the number of letters in the sum (as a word) of the 2 given numbers.
Write a method that given 2 number, returns the sum of all of the square numbers in the range between the two given numbers.
Lesson 7 of 8
Last updated more than 3 months ago.