cswork / OAOpen practice workspace

NutanixOA #2

Work Schedules (for MTS2)

EasyJudge-ready

Topics (AI-labelled)Enumeration

Given the total weekly work hours, the daily limit, and a partially fixed seven-day schedule, list all valid schedules.

Input

The input is work_hours, day_hours, pattern, separated by spaces; pattern has length 7, digits are fixed hours, and ? marks a day still to be scheduled.

Output

Output a compact JSON array of strings, sorted in ascending lexicographic order.

Example 1

Input:

24 4 08??840

Output:

["0804840","0813840","0822840","0831840","0840840"]

Example notes

Enumerate 0..day_hours for each question mark by position, pruning by the remaining hours and capacity.

Editorial

Loading solution…