Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

ScoresClump Homework problem

+5 votes
Hey guys,

I was having a little difficulty with just understanding what this problem is asking. I thought it was looking for a sequence of numbers all incrementing by the same value in a row 3 times. Such as <1,2,3> or <2,4,6>. But my assumption was wrong.

Then I assumed it was referring to just a group of numbers such as <3,5,5,7> since 5s are all the same score but it said that the numbers must, "differ from each other by at most 2" so scoresClump([3, 3, 7, 7, 9]) → true could not exist since it jumps from 3 to 7 which is greater than 2.

Could someone help me understand the problem a little fuller so I can tackle this problem easily.

Thank you!
asked Aug 22 in CSC 285 (F17) by Daniel Zwiener (100 points)

1 Answer

+4 votes
 
Best answer

The question is whether somewhere in the array there is a series of 3 numbers which all differ from each other by at most 2. [3, 3, 7, 7, 9] is true because [7, 7, 9] matches the criteria. The entire array doesn't have to differ by at most 2, just a series of 3 numbers within it.

answered Aug 22 by Vecna (100 points)
selected Aug 29 by Daniel Zwiener
This answer made solving the problem a lot easier! Thank you!
...