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

Given a list of Account records and a Decimal revenue threshold, update the Rating field to 'Cold' for every Account whose AnnualRevenue is not null, is less than the threshold, and whose current Rating is not already 'Cold'. Perform a single bulk DML update and return the number of accounts that were updated. Return 0 for null or empty inputs and for a null threshold.

Examples:

Input: accounts = [Account(AnnualRevenue=1000000, Rating='Warm'), Account(AnnualRevenue=5000000, Rating='Hot')], threshold = 2000000 Output: 1 Explanation: Only the first account is below the threshold and not already Cold Input: accounts = [Account(AnnualRevenue=100000, Rating='Cold')], threshold = 1000000 Output: 0 Explanation: The account is already Cold so no update is needed Input: accounts = [Account(AnnualRevenue=null, Rating='Warm')], threshold = 1000000 Output: 0 Explanation: Accounts with null AnnualRevenue are skipped Input: accounts = null, threshold = 1000 Output: 0 Explanation: Null input returns 0 Input: accounts = [Account(AnnualRevenue=500, Rating='Warm')], threshold = null Output: 0 Explanation: Null threshold returns 0
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