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.
A great question. In case someone is stuck, think of why this is in the "search" section. Could you efficiently search for the number of days it would take to produce the goal?
n <= 10^5 is the constraint. Which means that our algorithm can be O(n logn).
Given the number of days, it take O(n) to compute the items produced in those days by n machines. So we have log n searched allowed to find the correct day (where items produced fulfils the goal).
Does it ring any bells? Ping me if you still have a question.
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 →
A great question. In case someone is stuck, think of why this is in the "search" section. Could you efficiently search for the number of days it would take to produce the goal?
n <= 10^5 is the constraint. Which means that our algorithm can be O(n logn).
Given the number of days, it take O(n) to compute the items produced in those days by n machines. So we have log n searched allowed to find the correct day (where items produced fulfils the goal).
Does it ring any bells? Ping me if you still have a question.