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

Write a method that analyzes contact lead sources for accounts with high revenue (over $50 million annual revenue). The method should return a Map<String, Integer> where the key is the lead source and the value is the count of contacts from that lead source, but only for contacts whose accounts have high revenue.

This challenge tests your ability to combine complex SOQL relationship queries with GROUP BY aggregation and filtering across multiple objects.

Examples

Input: None (method queries contacts from high-revenue accounts) Output: { 'Web' => 4, 'Partner Referral' => 3, 'Trade Show' => 2, 'Employee Referral' => 1, 'Conference' => 2, ... } Explanation: Returns lead source distribution for contacts from accounts with >$50M revenue Input: If no accounts have high revenue Output: {} Explanation: Returns empty map when no high-revenue accounts exist
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 Feb 2026

Contest runs February 1 - 28. Complete challenges to climb the leaderboard!

Points are calculated for challenges completed during the contest period.