We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You just have to think about it in terms of machines that I have each day.
E.g
We have thre machines that take 1,2 and 3 days to deliver 1 product.
Consequently:
machine 1 produces 1 product/day
machine 2 produces 1/2 product/day
machine 3 produces 1/3 product/day
Now that the days are our independent variable, we can sum this potential productions with each machine BUILDING A LINEAR EQUATION in the form of:
y=((1/1)+(1/2)+(1/3))*x==>y=0.8333333*x
I recommend you graph that function and a constant function representing the target production. We just need to find in which number they meet. And here we have 2 different cases.
We meet exactly in an integer number of days
then we return the correct result
OR
We meet in a "decimal day" in (e.g 6.2)
then we add 1 to get to the next possible integer day.
Hope it helps.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Time Required
You are viewing a single comment's thread. Return to all comments →
Sure.
You just have to think about it in terms of machines that I have each day. E.g
Now that the days are our independent variable, we can sum this potential productions with each machine BUILDING A LINEAR EQUATION in the form of:
OR
Hope it helps.