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

Write a method that uses SOQL to find all Industry and BillingCountry combinations where more than one Account exists. Return a List<String> where each entry is formatted as 'Industry - Country (count)' and sorted alphabetically by the formatted string. Return an empty list if no combinations have more than one account.

Examples:

Input: Database contains 3 accounts with Industry='Technology' and BillingCountry='USA' Output: ['Technology - USA (3)'] Explanation: The combination has 3 accounts, so it is included Input: Database contains 2 accounts with Industry='Finance' and BillingCountry='UK', and 2 accounts with Industry='Healthcare' and BillingCountry='Canada' Output: ['Finance - UK (2)', 'Healthcare - Canada (2)'] Explanation: Both combinations have more than one account, sorted alphabetically Input: Database contains 1 account with Industry='Manufacturing' and BillingCountry='Germany' Output: [] Explanation: The combination has only 1 account, so it is excluded Input: Database contains 2 accounts with Industry='Technology' and BillingCountry='Japan', and 1 account with Industry='Technology' and BillingCountry='USA' Output: ['Technology - Japan (2)'] Explanation: Only the Japan combination has more than one account Input: No accounts in database Output: [] Explanation: Empty database returns empty list
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 2026

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

Points are calculated for challenges completed during the contest period.