GREEN: Implement feature to ignore numbers > 1000

- Added .where((n) => n <= 1000) filter
- Numbers greater than 1000 now excluded from sum
- Tests pass: '2,1001' returns 2, '1000,1001,2' returns 1002
This commit is contained in:
fiatcode 2026-02-18 12:59:01 +07:00
parent e8d2b769f3
commit ab5a97acc8

View file

@ -37,6 +37,7 @@ class StringCalculator {
.split(delimiter)
.where((s) => s.isNotEmpty)
.map((s) => int.parse(s))
.where((n) => n <= 1000) // Filter out numbers > 1000
.toList();
// Bug 3: Off-by-one in summation