Mid-Level
August 19, 2026Spot the bug: Flutter
One snippet. Find the bug, or prove there isn't one.
dart
1class PriceCalculator {
2 List<double> applyDiscount(List<double> prices, double discount) {
3 for (int i = 0; i < prices.length; i++) {
4 prices[i] = prices[i] * (1 - discount);
5 }
6 return prices;
7 }
8}
9
10void main() {
11 final original = [10.0, 20.0, 30.0];
12 final calc = PriceCalculator();
13 final discounted = calc.applyDiscount(original, 0.1);
14 print(original);
15}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.