about | help | code help+videos | done | prefs |
This problem MUST be solved recursively to earn credit! Any time a zero appears in a positive integer it is considered to be "spooky". In fact, the spooky value of a positive integer is the number of times the digit zero appears in the number. Leading zeros do not count, so 00420 means the same thing as 420 which only has one spooky digit. Your solution does not need to work for negative input parameters, but it DOES need to work if the input parameter is zero. This is a special case! Zero, by itself, is NOT considered to be spooky, so the number of spooky digits in zero is 0. Write a recursive method that returns the number of spooky digits in the input parameter. spookyMPHG(405) → 1 spookyMPHG(6323) → 0 spookyMPHG(10004) → 3 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 430
Copyright Nick Parlante 2017 - privacy