Question
Write a recursive method whose signature is: public int deleteBigger(int n, int x) The method will receive as parameters a positive integer n and a
Write a recursive method whose signature is: public int deleteBigger(int n, int x) The method will receive as parameters a positive integer n and a single digit number x. The method will delete from the number n all the digits that are greater than x and return the new number. For example, if we call the method with n = 43872 and x = 4, the method will return the number 432 (the digits 8 and 7 are greater than 4 and therefore deleted from the number). If we call the method with n = 163748 and n = 5 the method will return the number 134. Note that the order of the digits that remain in the number must remain the same as in the original number. If as a result of the deletion there are no digits left in the number, the method will return 0. Do not use loops at all in this question! It is allowed to define private helper methods.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started