Advertisement
KBonnicksen

Untitled

Jun 17th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public static int digitMatch(int a, int b){
  2.     if(< 0 || b < 0){
  3.         throw new IllegalArgumentException();
  4.     }
  5.     if(/ 10 == 0 || b / 10 == 0){
  6.         if(% 10 == b % 10){
  7.             return 1;
  8.         }
  9.         return 0;
  10.     }
  11.     if(% 10 == b % 10){
  12.         return 1 + digitMatch(/ 10, b / 10);
  13.     }
  14.     return digitMatch(/ 10, b / 10);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement