Question: Write a java recursive method digitMatch that takes two nonnegative integers as parameters and that returns the number of digits that match between them. Two
Write a java recursive method digitMatch that takes two nonnegative integers as parameters and that returns the number of digits that match between them. Two digits match if they are equal and have the same relative position starting from the end of the number (i.e., starting with the ones digit). In other words, the method should compare the last digits of each number, the second-to-last digits of each number, the third-to-last digits of each number, and so forth, counting how many pairs match. For example, for the call digitMatch(1072503891, 62530841), the method should return 4 in this case because 4 of these pairs match (2-2, 5-5, 8-8, and 1-1).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
