FastPrepWork Schedules (for MTS2)
Problems/Work Schedules (for MTS2)

Work Schedules (for MTS2)

Nutanix logoNutanix● EasyFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

An employee has to work exactly as many hours as they are told to each week, scheduling no more than a given daily maximum number of hours. On some days, the hours worked will be given. The employee gets to choose the remainder of their schedule, within the given limits.

A completed schedule consists of exactly 7 digits in the range 0 to 8 that represent each day's work hours. A pattern string similar to the schedule is given, but the scheduled hours are marked by a question mark, ?, (ascii 63 decimal). Given a maximum number of hours that can be worked in a day, replace the question marks with digits so the scheduled hours is exactly the total hours that must be worked in a week.

Determine all possible work schedules that meet the requirements and return them as a list of strings, sorted ascending.

Function

findSchedules(work_hours: int, day_hours: int, pattern: String) → String[]

Complete the function findSchedules in the editor.

findSchedules has the following parameter(s):

  1. 1. int work_hours: the hours that must be worked in the week
  2. 2. int day_hours: the maximum hours that may be worked in a day
  3. 3. String pattern: the partially completed schedule

Returns String arr[]: represents all possible valid schedules (must be ordered lexicographically ascending)

Examples

Example 1

work_hours = 24day_hours = 4pattern = "08??840"return = ["0804840", "0813840", "0822840", "0831840", "0840840"]

There are 2 unknown days and 24 - 20 = 4 hours left to schedule. The five listed schedules use every split of 4 in which each day is between 0 and 4 hours.

Example 2

work_hours = 56day_hours = 8pattern = "???8???"return = ["8888888"]

There is only one way to work 56 hours in 7 days when at most 8 hours may be worked each day.

Example 3

work_hours = 3day_hours = 2pattern = "??2??00"return = ["0020100", "0021000", "0120000", "1020000"]

The fixed 2 hours leave 1 more hour to schedule, and it can be placed on any one of the four question-mark days.

Constraints

  • 1 ≤ work_hours ≤ 56
  • 1 ≤ day_hours ≤ 8
  • | pattern | = 7
  • Each character of pattern ∈ {0, 1, ..., 8}
  • There is at least one correct schedule.

More Nutanix interview questions

  • Print FooBar AlternatelyPHONE SCREEN · Seen Nov 2026
  • Design Hit CounterONSITE INTERVIEW · Seen Oct 2026
  • Peak Process MemoryONSITE INTERVIEW · Seen Aug 2026
  • Good SubsequencesOA · Seen Jul 2026
  • Min Cost to Connect All PointsOA · Seen Jun 2026
  • Minimum Operations to Transform ArrayONSITE INTERVIEW · Seen Jun 2026
  • Count Connected Components in an Undirected GraphONSITE INTERVIEW · Seen Aug 2025
  • Digit Changes for a Multiple of 9OA · Seen Aug 2025
  • Gas Station Loop StartOA · Seen Aug 2025
  • LRU CacheONSITE INTERVIEW · Seen Aug 2025

Similar questions at other companies

  • Work ScheduleSnowflake · OASnowflake interview questions
  • DFS Subsequences of a String (For MLE)Wayfair · OAWayfair interview questions
  • Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions
  • String Permutations in Custom Character OrderWex · OA · PHONE SCREEN
  • Generate ParenthesesThe Walt Disney Company · OAThe Walt Disney Company interview questions
  • Reverse and AppendUber · OAUber interview questions
  • All Palindrome PartitionsExpedia · OAExpedia interview questions
  • Generate ParenthesesAtlassian · OAAtlassian interview questions
  • Equal-Sum Digit PartitionsAlchemy · OA
  • Maximum Number after K SwapsIntuit · OAIntuit interview questions

Nutanix interview experiences

  • Nutanix interviews · November 2026
  • Nutanix SWE Intern Phone Screens: 20 Experiences (Part 3 of 3)
  • Nutanix SWE Intern OA Questions: 16 Experiences (Part 2 of 3)
  • Nutanix U.S. SWE Intern Interviews: 54 Experiences (Part 1 of 3)
  • Nutanix SWE OA and Interviews, Level Not Reported: 9 Experiences
  • Nutanix Intern Debugging Round and Interviews: 25 Experiences
All Nutanix interview questionsSee Nutanix hiring insights
Saved
class Solution {
    public String[] findSchedules(int work_hours, int day_hours, String pattern) {
      // write your code here
    }

}
Checking account…