about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy