id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > mar27_2017_HL_digitsMatch
prev  |  next  |  chance

Write a RECURSIVE method that returns the number of times the digits of a number match in position from each end of the number. For example, 57825 has ONE set of digits that match (the 5's at each end). When a number has an odd number of digits, the middle digit matching itself is NOT considered a match. As another example, the number 12344321 has FOUR matches. You MUST solve this RECURSIVELY and you may NOT use any string methods or strings. It may help to write a helper method.


mar27_2017_HL_digitsMatch(1020330201) → 5
mar27_2017_HL_digitsMatch(851) → 0
mar27_2017_HL_digitsMatch(4) → 0

...Save, Compile, Run (ctrl-enter)

public int mar27_2017_HL_digitsMatch(int num) }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 430

Copyright Nick Parlante 2017 - privacy