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

 

apcsaStringsMostRepeated


Given two String inputs a and b, find and return the three-character substring from a that occurs the most times in b. If no substrings from a are found in b, return an empty String. If a tie occurs, return the first substring from a that occurs the most times. Precondition: a.length() > 2.


HINT: you will probably want a nested loop structure here as well, but the two loops are likely to have very different bounds.

apcsaStringsMostRepeated("aaaBBB", "aaa aaa BBB") → "aaa"
apcsaStringsMostRepeated("abc", "abcabcabc") → "abc"
apcsaStringsMostRepeated("abcdef", "bcd") → "bcd"

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

public String apcsaStringsMostRepeated(String a, String 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: 300

Copyright Nick Parlante 2017 - privacy