</>OfferRetriever
DashboardDiscuss
NEW

July 4th Sale

Limited Time Deal: Unlock all premium questions for over 40% off

$10.42$6.25

10

:

09

:

27

:

46

Get this deal
Back to Dashboard

[OA] Work Schedule Generator

Medium

A factory uses a shift planning system to schedule worker hours across a 7-day week. Each day is represented as a single character in a pattern string of length 7. A character is either a digit '0' through '8' (the number of hours worked that day) or '?' (an unscheduled day).

Given a target number of weekly hours targetHours, a maximum hours per shift maxShiftHours (between 0 and 8 inclusive), and a 7-character pattern string, replace each '?' with a digit from '0' to maxShiftHours (inclusive) such that the sum of all 7 digits equals targetHours. Return all valid completed patterns in ascending lexicographic order. ...