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

Query all accounts that have a non-null AnnualRevenue. Calculate the average AnnualRevenue across all such accounts. Return a sorted list of account names where the AnnualRevenue exceeds that average. Sort the names alphabetically.

Examples:

Assume accounts with AnnualRevenue: [500000, 1000000, 2000000, 3000000] Average = 1625000 Accounts above average: those with 2000000 and 3000000 Output: [names of those accounts sorted alphabetically] Explanation: Only accounts strictly above the average are included If no accounts have AnnualRevenue set: Output: [] Explanation: Return empty list when no revenue data exists
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 account

How 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 Mar/April 2026

Contest runs March 3 - April 30. Complete challenges to climb the leaderboard!

Points are calculated for challenges completed during the contest period.