Given a year and month (as integers), calculate the total number of workdays (Monday through Friday) in that month. Do not account for holidays - just count weekdays.
Return the count as an Integer. Return null for null inputs. Return 0 for invalid months (less than 1 or greater than 12).
Examples:
Input: year = 2026, month = 2
Output: 20
Explanation: February 2026 has 20 weekdays (Monday-Friday)
Input: year = 2024, month = 2
Output: 21
Explanation: February 2024 is a leap year with 29 days and 21 weekdays
Input: year = 2026, month = 1
Output: 22
Explanation: January 2026 has 22 weekdays
Input: year = 2026, month = 13
Output: 0
Explanation: Month 13 is invalid, return 0
Input: year = null, month = 2
Output: null
Explanation: Null input returns null
Welcome to Lightning Challenge!
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
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.