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:
parent
e8d2b769f3
commit
ab5a97acc8
1 changed files with 1 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue