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

 

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

Write a method that accepts a string of nothing but numeric digits. The string will have at least one character (no empty strings). The first character will indicate which digit to perform a "checksum" on. If the first digit is a "3" return the number of 3's that appear in the string EXCLUDING that first "3". If the first digit is a "7" return the number of 7's that appear in the string EXCLUDING that first "7". Look at the test data for examples.


airplaneChecksum("10001000") → 1
airplaneChecksum("523325") → 1
airplaneChecksum("722535327747") → 3

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

public int airplaneChecksum(String str) { }

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