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

 

countAxA


Given a string and two letters (c1 and c2), return a count of the number of times "axb" occurs in the string, where x is any character. For example, given the string "antiaircraft" and the letters 'a' and 't', your method should return 2. The three-letter patterns may overlap. For example, "aaaa" has two occurrences of "axa".


countAxA("antiaircraft", "a", "t") → 2
countAxA("bearberry", "e", "r") → 2
countAxA("aaaa", "a", "a") → 2

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

public int countAxA(String str, char c1, char c2) { }

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