There are 3 parts Part 1. Write a task scheduler. Start be defining a ‘Task’ class and a ‘Thread’ class. Define a function that will take in some list of Tasks and some list of Threads and assign every task to a thread. The function will print out every ‘step’ of the function. Example: for tasks=[A,B,C], numThreads=2 “Step 1 Task A assigned to Thread 1 Task B assigned to Thread 2 Step 2 Task C assigned to Thread 1 Part 2. Here is where things get dumb. Now each Task is composed of some subtasks that must all be completed before the Task is finished. Each Thread can only work one certain subtasks as well. Output the NON-OPTIMAL solution. I repeat, non-optimal - if you optimize by making sure every thread is occupied when a task could be operated on by that thread then you are wrong. They will give you a specific output that they want, and you must generate that output in that order. They basically want you to create a specific non-optimal solution. Makes no sense what signal this is trying to measure for new-hires but whatever ¯\_(ツ)_/¯ Example: TaskA: subtasks: [“square”, “circle”] TaskB:subtasks: [“star”] Thread1: [“square”] Thread2: [“ circle”, “star”] Output: “ step1 Task A assigned to Thread 1 Step2 Task A assigned to Thread2 Step3 Task B assigned to Thread2 “ The example is a little more complex but that’s the basic idea Part 3. Didn’t get to it. Part 2 was too dumb and I spent too much time optimizing after telling the interviewer how I was going to optimize. After I was almost done he was like “You must print out the exact same output as the example output”
Check out your Company Bowl for anonymous work chats.