6 kyu

How Many Reindeers?

493 of 1,655BattleRattle

Description:

Santa puts all the presents into the huge sack. In order to let his reindeers rest a bit, he only takes as many reindeers with him as he is required to do. The others may take a nap.

Two reindeers are always required for the sleigh and Santa himself. Additionally he needs 1 reindeer per 30 presents. As you know, Santa has 8 reindeers in total, so he can deliver up to 180 presents at once (2 reindeers for Santa and the sleigh + 6 reindeers with 30 presents each).

Complete the function reindeers(), which takes a number of presents and returns the minimum numbers of required reindeers. If the number of presents is too high, throw an error.

Examples (input -> output / error)

0 -> 2
1 -> 3
30 -> 3
200 -> throws an error
Algorithms

Similar Kata:

Stats:

CreatedDec 15, 2013
PublishedDec 15, 2013
Warriors Trained2183
Total Skips116
Total Code Submissions5040
Total Times Completed1655
JavaScript Completions493
CoffeeScript Completions60
Ruby Completions353
Python Completions807
Total Stars18
% of votes with a positive feedback rating86% of 242
Total "Very Satisfied" Votes186
Total "Somewhat Satisfied" Votes46
Total "Not Satisfied" Votes7
Total Rank Assessments6
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • BattleRattle Avatar
  • jhoffner Avatar
  • Azuaron Avatar
  • akar-0 Avatar
  • sid114 Avatar
Ad