Recursion: Integer Digits Count

Published by Deep Xavier in

Create a function that recursively counts the integer's number of digits.

Examples

count(318) ➞ 3
 
count(-92563) ➞ 5
 
count(4666) ➞ 4

count(-314890) ➞ 6

count(654321) ➞ 6

count(638476) ➞ 6

Notes

  • You are expected to solve this challenge via recursion.
  • You can check on the Resources tab for more details about recursion in Java.
  • An iterative version of this challenge can be found via this link.
  • A collection of challenges in recursion can be found via this link.
Watch a quick demo on how Edabit works.