#10922 - 2 the 9s

Solved By:peter
Theory Difficulty:trivial
Coding Difficulty:trivial
Algorithms Used:recursion
Solution Description: Literally define a recursive function that takes integers a and b.

If a < 10, return b if a % 9 == 0, and return -1 otherwise.

If a >= 10, sum its digits and return recursivefunction(sum, b+1)

Then, in your normal function, sum the digits of the input right away, and just return recursivefunction(sum, 1).

Solved By:wesley
Theory Difficulty:trivial
Coding Difficulty:trivial
Algorithms Used:sorting
Solution Description: Just keep adding all of the digits together (iteratively; no need for recursion) until the sum of digits is less than 10. If you hit 9, then success, otherwise, failure.






Copyright 2008 (c) QuestToSolve.Com - Graphs Powered By PHPGraphLib - Click For Official Site