Program hangs!
Description:
It's 3AM and you get the dreaded call from a customer: the program your company sold them is hanging. You eventually trace the problem down to a call to a function named mystery
. Usually, mystery
works fine and produces an integer result for an integer input. However, on certain inputs, the mystery
function just locks up.
Unfortunately, the mystery
function is part of a third-party library, and you don't have access to the source code. Uck. It may take a while to get support from the provider of the library, and in the meantime, your customer is getting frustrated.
Your mission, should you choose to accept it, is to create a new function called wrap_mystery
that returns the same results as mystery
, but does not hang. Since you're not sure exactly what values mystery
should be returning for hangs, just have wrap_mystery
return -1 for problematic input. Your customer is counting on you!
wrap_mystery
will only be called with positive integers less than 1,000,000.
Similar Kata:
Stats:
Created | Sep 16, 2015 |
Published | Sep 16, 2015 |
Warriors Trained | 687 |
Total Skips | 94 |
Total Code Submissions | 653 |
Total Times Completed | 116 |
Python Completions | 116 |
Total Stars | 17 |
% of votes with a positive feedback rating | 80% of 40 |
Total "Very Satisfied" Votes | 27 |
Total "Somewhat Satisfied" Votes | 10 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |