This question runs in a pre-configured Salesforce environment - no personal connection required.
You are a Salesforce developer tasked with helping the sales operations team push out close dates on pipeline opportunities. Given a list of Opportunity records and a number of days, extend the CloseDate of each opportunity by the specified number of days. Perform the update in a single DML statement and return the count of records updated.
If the input list is null or empty, return 0.
Example 1:
Input: opps = [list of 34 open opportunities], daysToExtend = 30
Output: 34
Explanation: All 34 open opportunities have their close dates extended by 30 days.
Example 2:
Input: opps = null
Output: 0
Explanation: Null input returns 0 immediately without performing any DML.
Example 3:
Input: opps = [] (empty list)
Output: 0
Explanation: An empty list returns 0 without performing any DML.
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 August 2026
Contest runs August 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.