This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that returns a Map from BillingCountry to Account Name, where the Name is the Customer-type Account with the highest AnnualRevenue in that country. Only include Accounts where Type equals 'Customer' and BillingCountry is not null. Countries with no Customer-type Accounts must not appear in the result. The method takes no parameters.
Examples:
Input: (no parameters)
Output: { 'USA' => 'Best Tech Inc', 'Canada' => 'Maple Corp', ... }
Explanation: For each country, the customer with the largest AnnualRevenue is selected
Input: (no parameters)
Output: { 'Germany' => 'Berlin Auto AG' }
Explanation: Only one customer per country is returned, even if multiple customers exist
Input: (no parameters)
Output: {}
Explanation: If no customer accounts exist with non-null country, the result is an empty map
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.