As reported: DocuSign intern hiring, on-campus (2026), technical round: build a parser for cron jobs. A timestamp is a 5-tuple (minute, hour, day, month, year); a list of jobs with 5-tuple schedules is kept, where
*matches any value; return the jobs that run at a given 5-tuple. The interviewer expected OOP principles and clean code rather than a bare algorithm — separate classes per unit with validation of values (for example, minute 61 is invalid).
Implement CronScheduler:
CronScheduler()— no jobs yet.addJob(name, schedule)—scheduleis five fields separated by single spaces:minute hour day month year. Each field is*(any value) or a number. If the schedule is valid, store the job and returntrue; otherwise store nothing and returnfalse.getJobs(minute, hour, day, month, year)— return the names of all stored jobs whose schedule matches this moment, in the order the jobs were added.
A field matches when it is * or equals the timestamp's value for that unit.
Valid values
| field | range |
|---|---|
| minute | 0 – 59 |
| hour | 0 – 23 |
| day | 1 – 31 |
| month | 1 – 12 |
| year | 1970 – 2099 |
A schedule is invalid if it does not have exactly five fields, a field is neither * nor a string of digits (e.g. -1, 1.5, ab, **), or a number is outside its range.
Example
["CronScheduler","addJob","addJob","addJob","addJob","getJobs","getJobs"]
[[],["backup","0 2 * * *"],["report","30 9 1 * 2026"],["bad","61 * * * *"],["tick","* * * * *"],[0,2,15,6,2026],[30,9,1,7,2026]]
-> [null,true,true,false,true,["backup","tick"],["report","tick"]]
Constraints: at most 2000 calls; job names are unique, non-empty, without spaces; every field token has at most 6 characters; getJobs is always called with valid values.
Code runner format: LeetCode's design format — line 1 the method names, line 2 their arguments. The harness prints the list of results (null for the constructor).