Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Work Schedule: Python 3 Please Work Schedule You just got a new job where you have to work exactly as many hours as you are

Work Schedule: Python 3 Please

image text in transcribed

Work Schedule You just got a new job where you have to work exactly as many hours as you are told each week, working no more than a daily maximum number of hours per day. Some of the days, they tell you how many hours you will work. You get to choose the remainder of your schedule, within the limits. A completed schedule consists of exactly 7 digits in the range 0 to 8 representing each day's hours to be worked. You will get a pattern string similar to the schedule, but with some of the digits replaced by a question mark, ?, (ascii 63 decimal). Given a maximum number of hours you can work in a day, replace the question marks with digits so that the sum of the scheduled hours is exactly the hours you must work in a week. Return a string array with all possible schedules you can create, ordered lexicographically For example, your partial schedule, pattern-08?7840, your required hours, work-hours-24, and you can only work, at most, day-hours = 4 hours per day during the two days in question. You have two days on which you must work 24-20-4 more hours for the week. All of your possible schedules are listed below 0804840 0813840 0822840 0831840 0840840 Function Description Complete the function findSchedules in the editor below. The function must return an array of strings that represents all possible vali lexicographically d schedules. The strings must be ordered findSchedules has the following parameter(s): work_hours: an integer that represents the hours you must work in the week day_hours: an integer that represents the maximum hours you may work in a day pattern: a string that represents the partially completed schedule Constraints 1s work_hours s 56 1 s day hours s 8 pattern |-7 Each character of pattern e 0,,8 There is at least one correct schedule Input Format For Custom Testing Sample Case 0 Sample Input 0 56 ??78??? Sample Output 0 Explanation O work hours 56 day_hours8 pattern?778777 There is only one way to work 56 hours in 7 days of 8 hours

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

WHO interacts with WHOM?

Answered: 1 week ago

Question

a user receives this error message: not secure

Answered: 1 week ago

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago