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

 

scoreGuess


APFR21-1 Write the scoreGuess method. To determine the score to be returned, scoreGuess finds the number of times that guess occurs as a substring of word and then multiplies that number by the square of the length of guess. Occurrences of guess may overlap within word. for example: 1. scoreGuess("iss", "mississippi") "iss" appears 2 times Length of "iss" = 3 → 3² = 9 Score = 2 × 9 = 18


scoreGuess("i", "mississippi") → 4
scoreGuess("iss", "mississippi") → 18
scoreGuess("issipp", "mississippi") → 36

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

public int scoreGuess(String guess,String word) { }

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

Copyright Nick Parlante 2017 - privacy