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!

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 Jan 2026

Contest runs January 1 - 31. Complete challenges to climb the leaderboard!

Points are calculated for challenges completed during the contest period.