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

Write a method that creates a comprehensive contact report for multiple countries. The method should take a List of country names and return a Map<String, Map<String, Object>> where:

  • The outer key is the country name
  • The inner Map contains: 'contactCount' (Integer), 'totalRevenue' (Decimal), 'avgRevenue' (Decimal), and 'topContact' (String with name and title)

This advanced challenge tests your ability to combine complex SOQL queries, data aggregation, nested Map structures, and mathematical calculations across multiple objects and countries.

Examples

Input: countries = ['USA', 'Germany', 'Japan'] Output: { 'USA' => { 'contactCount' => 12, 'totalRevenue' => 450000000.00, 'avgRevenue' => 37500000.00, 'topContact' => 'David Thompson - Founder' }, 'Germany' => { 'contactCount' => 1, 'totalRevenue' => 75000000.00, 'avgRevenue' => 75000000.00, 'topContact' => 'Hans Mueller - Operations Director' }, 'Japan' => { 'contactCount' => 1, 'totalRevenue' => 65000000.00, 'avgRevenue' => 65000000.00, 'topContact' => 'Takeshi Yamamoto - CTO' } } Explanation: Returns comprehensive country-level contact and revenue analysis Input: countries = ['NonExistent'] Output: {} Explanation: Returns empty map when no data exists for the countries
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.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In