This question runs in a pre-configured Salesforce environment - no personal connection required.

Query all accounts and return a Map where the key is the Account Type (such as Customer, Prospect, Partner) and the value is the sum of AnnualRevenue for accounts of that type. Only include accounts with non-null Type and non-null AnnualRevenue values. Use aggregate SOQL queries with GROUP BY to efficiently calculate sums per type.

Examples:

Output: {'Customer' => 450000000.00, 'Prospect' => 125000000.00} Explanation: Sums the AnnualRevenue for all Customer accounts and all Prospect accounts Output: {'Partner' => 75000000.00} Explanation: Only Partner accounts exist with non-null revenue in the org
Apex Code Editor

Welcome to Lightning Challenge!

How It Works

  • • Write your solution in the code editor
  • • This challenge runs without connecting your own org
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 #CodeEveryDay July 2026

Contest runs July 1 - 31. Complete challenges to climb the leaderboard!

Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In