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!
Create an Account
Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.
Create accountHow It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay Feb 2026
Contest runs February 1 - 28. Complete challenges to climb the leaderboard!
Points are calculated for challenges completed during the contest period.