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.
Hey I took a break from hackerrank sorry for the late reply. What I did was looking for the minimum number of days to produce an output with binary search.
Computing the the output for n days takes linear time. And there is no way to avoid this. So I came up with a lowerbound and upperbound to what the number of days could be since the output is nondecreasing binary search works fine.
Minimum Time Required
You are viewing a single comment's thread. Return to all comments →
Hey I took a break from hackerrank sorry for the late reply. What I did was looking for the minimum number of days to produce an output with binary search.
Computing the the output for n days takes linear time. And there is no way to avoid this. So I came up with a lowerbound and upperbound to what the number of days could be since the output is nondecreasing binary search works fine.