EASYasked at 1 company

Day of the Year

A easy-tier problem at 48% community acceptance, tagged with Math, String. Reported in interviews at ZScaler and 0 others.

Founder's read

Day of the Year is a deceptive easy problem that tests whether you can actually code a date calculator without fumbling the leap-year logic. ZScaler has asked it. You're given a date string like "2019-03-01" and need to return which day of the year it is, 1 through 365 or 366. The 48% acceptance rate tells you most people get tripped up on the leap-year edge case or off-by-one errors. It's the kind of problem that feels trivial until you're in the live OA, panic over whether 2020 is a leap year, and suddenly have no clean solution. If you hit this during your assessment and blank on the rules, StealthCoder runs invisibly and surfaces the working code in seconds.

Companies asking
1
Difficulty
EASY
Acceptance
48%

Companies that ask "Day of the Year"

If this hits your live OA

Day of the Year is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The trick is not the algorithm, it's the leap-year rule. A year is a leap year if it's divisible by 4, except centuries (divisible by 100) unless also divisible by 400. Most candidates either forget the century exception or hardcode months wrong. The obvious path is to manually sum days in each month up to the target date, adjust the February count based on leap-year status, and return the total. Where people stumble: confusing which direction to adjust, miscounting February as 28 vs 29, or missing that you need to check the year's leap status first. The problem combines String parsing (extract year, month, day from the input) and Math (day arithmetic and leap-year modulo logic). There's no trick to optimize, just correctness under pressure. That's exactly when StealthCoder provides the hedge.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Day of the Year recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Day of the Year interview FAQ

Is this problem still asked at real interviews?+

Yes. ZScaler has asked it. The acceptance rate sits at 48%, suggesting it's not a warm-up problem at most companies. It screens for coding discipline and attention to edge cases, which hiring teams value even at the easy difficulty level.

What's the leap-year rule I always forget?+

Leap year if divisible by 4, except centuries (divisible by 100) are not leap years, except if divisible by 400 they are. So 2000 is a leap year, 1900 is not, 2020 is. Write this as a helper function once and reuse it.

Do I need a calendar library or write it by hand?+

Most online assessments allow standard libraries. Use Python's datetime or Java's LocalDate if available. If you have to code it from scratch, precompute a days-per-month array and adjust February based on leap-year status. Keep it simple.

What's the most common mistake on this problem?+

Off-by-one errors and forgetting the leap-year century exception. Candidates often iterate wrong or forget to include the current day in the count. Write a few test cases (Jan 1, Feb 29 in a leap year, Dec 31) and trace through manually.

How does this relate to String and Math topics?+

String because you parse the input date. Math because you compute the leap-year status and sum the days. Neither is complex on its own, but combining parsing with correct arithmetic under time pressure is where candidates fail.

Want the actual problem statement? View "Day of the Year" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.