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

Find all Account names that have more than a specified number of Contacts. Return a Map where the key is the Account name and the value is the number of Contacts for that Account. Only include Accounts that meet or exceed the minimum contact count threshold.

This challenge tests your understanding of SOQL aggregate queries with GROUP BY and HAVING clauses. The HAVING clause filters grouped results based on aggregate function values, which is essential for reporting and data analysis in Salesforce.

Examples:

Input: minContactCount = 2 Output: {'Acme Corporation': 3, 'Global Industries': 2, 'Tech Solutions': 4} Explanation: Returns only accounts with 2 or more contacts, with contact counts Input: minContactCount = 1 Output: {'Acme Corporation': 3, 'Global Industries': 2, 'Tech Solutions': 4, 'Small Business': 1} Explanation: Returns all accounts with at least 1 contact Input: minContactCount = 100 Output: {} Explanation: Returns empty map when no accounts have 100+ contacts
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