Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are N houses ( numbered from 0 to N - 1 ) along a street. In each of them, recyclable trash ( plastic ,
There are houses numbered from to along a street. In each of them, recyclable trash plastic glass, metal is collected into separate bags.
There are three trucks that collect the trash. Each of them collects a separate type of trash the first collects plastic, the second, glass and the third, metal All the trucks begin and end their jobs at the starting end of the street. Passing from the starting point to house number takes minutes. Passing between houses number and for in the range to takes minutes. Loading one bag onto the truck takes one minute.
For example, means that passing between the starting point and house number takes minutes and passing between houses number and takes minutes.
Each of the houses has already collected some bags or possibly no bags of recyclable trash. The number of bags that house number has collected is recorded in string composed of letters plasticglass and metal For example, GMG means that house number has collected two bags of glass and one bag of metal. Each house may collect more than one bag of each type.
All of the trucks start their jobs simultaneously. Each finishes its job after collecting all of the bags of the given type of trash and returning back to the starting point. What is the minimum number of minutes that will pass before all the trucks finish all the jobs?
Write a function:
class Solution public int solutionint D String T;
that, given array of integers and array of strings, returns the minimum
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started