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

 

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

Without using arrays or strings, write a method that returns the number of occurrences of a particular set of digits within a positive integer. For example, the set of digits 73 occurs 2 times in the number 731773. Two parameters will be passed in. As preconditions, you may assume that 'num' will be positive and 'target' will be a positive integer with fewer digits than 'num'. Return the number of time 'target' occurs in 'num'. Note that LEADING zeros are NOT allowed.


abc2countMatch(40401, 40) → 2
abc2countMatch(128142, 12) → 1
abc2countMatch(94200, 4) → 1

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

public int abc2countMatch(int num, int target) { }

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

Copyright Nick Parlante 2017 - privacy