Amy WOD: Suzuki’s stairs

Suzuki is a monk who climbs a large staircase to the monastery everyday as part of a ritual. Some days of the week he climbs more stairs than others depending on the number of students he must train during that day of the week. He is curious how many stairs he climbs over the course of a year and has gathered sample data points for each of the seven days of the week.

You must write a function called SuzukiStairs that receives an array containing data collected by Suzuki. The array consists of 7 subarrays, one for each day of the week. The subarrays will have different numbers of data points because Suzuki sometimes forgot to record data for a given day. For example:

 [[23, 25, 32], [4, 2], [1, 1, 1, 3], [15, 18, 19], [2], [31], [11, 13, 9]]

To get the best estimate, first determine the average number of stairs for each day of the week from the sample data set. Next, add those averages together to the best estimate of the average stairs in a week. Finally, multiple the results by 52 to get the estimate for the number of stairs Suzuki will climb in an entire year.

Ready? Let’s begin:

  1. Login to JSFiddle.

  2. Create a Javascript function called “SuzukiStairs”. The main method should accept an array of seven arrays and return an integer indicating your estimate of the number of stairs Suzuki will climb in a year.

  3. Informally test your program by running it and inspecting the output.

  4. When you are confident the function works correctly, press “Save” to create a URL to your JSFiddle.

  5. Raise your hand to let me know you have finished.

Rx: < 8 min Av: 8 - 12 min Sd: 12 - 15 min DNF: 15+ min

Submission instructions

You do not have to submit this Amy WOD.


This page is also available via http://goo.gl/cS8JzJ