Senior
4 ottobre 2026Trova il bug: .NET
Uno snippet di codice. Trova il bug, o dimostra che non ce n'è.
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}Clicca sulle righe che causano il problema.
Il tuo verdetto
Un tentativo al giorno. La risposta appare subito dopo.
Mantieni la tua serie
Crea un account per conservare la tua serie e seguire i tuoi progressi.