Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMaarten De Kruif
7,314 PointsRepeatdetector detects repititions when there are none
I dont have a clue? Can anyone help me.
namespace Treehouse.CodeChallenges
{
class SequenceDetector
{
public virtual bool Scan(int[] sequence)
{
return true;
}
}
class RepeatDetector : SequenceDetector
{
public override bool Scan(int[] sequence)
{
return true;
}
}
}
1 Answer
Steven Parker
231,269 PointsRight now your method always returns true.
But the instructions say that it should "return true if any value in the array is a repeat of the value immediately preceding it". So you probably want a loop that steps through the array, starting with the second item, and compares each item to the one before it. If there's a match, return true. If the loop finishes without finding a match, return false.
Also, while it doesn't seem to affect the challenge, I think the work for tasks 2 and 3 was intended to be done in the other file (RepeatDetector.cs).