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

 

abraskin@mbusd.org > middleCount
prev  |  next  |  chance

Given two integer values, count the occurrences of the middle digit of the first value in the second value. If there is an even number of digits in the first number, return 0 instead. For example, given 721 and 123321, the middle digit is 2 and there are two 2's in the second number. But given 123321 and 721, there is an even number of digits in the first number so 0 is returned.


middleCount(721, 123321) → 2
middleCount(123321, 721) → 0
middleCount(12, 45645645) → 0

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

public int middleCount(int a, int b) { }

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: 200

Copyright Nick Parlante 2017 - privacy