Question: 2. Write a recursive method largestDigit that accepts an integer parameter and returns the largest digit value that appears in that integer. Your method should
2. Write a recursive method largestDigit that accepts an integer parameter and returns the largest digit value that appears in that integer. Your method should work for both positive and negative numbers. If a number contains only a single digit, that digit's value is by definition the largest. The following table shows several example calls: Calle Value Returned largestDigit(14263203) 62 largestDigit(845) se largestDigit(52649 92 largestDigit(3) largestDigit() largestDigit(-573026)ze largestDigit(-2) 2e 32 ee ttttttt Obey the following restrictions in your solution: . You may not use a String, Scanner, array, or any data structure list, stack, map. etc.). Your method must be recursive and not use any loops (for, while, etc.). Your solution should run in no worse than O(N) time, where N is the number of digits in the number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
