Senior
October 4, 2026

Spot the bug: .NET

One snippet. Find the bug, or prove there isn't one.

csharp
1public class RangeValidator
2{
3    public bool IsWithinRange(int value, int maxDistance)
4    {
5        if (maxDistance < 0)
6            throw new ArgumentException("maxDistance must be non-negative");
7
8        int distance = Math.Abs(value);
9        return distance <= maxDistance;
10    }
11}

Click the lines that carry the problem.

Your verdict

One attempt per day. The answer shows up right after.

Keep your streak

Create an account to keep your streak and track your progress.

Create an account