This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that finds the Account with the highest AnnualRevenue for each Account Type. Return a Map where the key is the Type (String) and the value is the Account Name (String) with the highest revenue for that type. Only include types that have at least one account with non-null AnnualRevenue.
Method Signature:
public static Map<String, String> getHighestRevenueByType()
Examples:
Input: No parameters
Output: {'Customer' => 'Nordic Petroleum', 'Prospect' => 'Mumbai Tech Hub'}
Explanation: Nordic Petroleum has the highest revenue among Customer accounts, and Mumbai Tech Hub has the highest revenue among Prospect accounts
Input: No parameters
Output: {'Customer' => 'Alpine Private Bank'}
Explanation: If only Customer accounts have non-null revenue values, only Customer type appears in the result with its highest revenue account name
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
🏆 All Time Leaderboard
Contest runs January 1, 1970 - December 31, 9999. Complete challenges to climb the leaderboard!
Points are calculated for challenges completed during the contest period.