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

 

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

This method returns the number of times "42" appears at the start or end of the input parameter str. If there are no "42" appearances at the start or end of the string, return 0. If the string starts OR ends in "42" return 1. If the string both starts AND ends in two different copies of "42" return 2.


num42Maybe("42") → 1
num42Maybe("4242") → 2
num42Maybe("4") → 0

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

public int num42Maybe(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: 190

Copyright Nick Parlante 2017 - privacy