HomeChallengesRepsProblemsLeaderboardTake a challenge

Loops that want to be LINQ

A hand-rolled group-and-total. Say what you want instead of how to get it.

Beginner18 min on the clock6 graded checks · 100 pointsC# Foundations
Graded by reading your code against the checklist below.

What you build

  • Drop the refunded sales before doing any work on them
  • Group what is left by category
  • Total each group
  • Order the result by revenue, highest first
  • Return a materialised list, not a running dictionary you built by hand

Done means

Same categories, same totals, no += bookkeeping.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Group by category with GroupBy+25LINQ instead of loops
  2. Total each group+20LINQ instead of loops
  3. Project each group into a result shape+20LINQ instead of loops
  4. Filter before you group+15LINQ instead of loops
  5. Let LINQ do the bookkeeping+10LINQ instead of loops
  6. Order the result+10LINQ instead of loops

What it teaches

The rest of C# Foundations