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.
Just one more situation: If the global minimum is positive, that means we'll survive the worst case starting from the 0th position itself. So in that case the answer will be station[0].
Otherwise, if the minimum is negative, we return station[min_index + 1].
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Truck Tour
You are viewing a single comment's thread. Return to all comments →
Just one more situation: If the global minimum is positive, that means we'll survive the worst case starting from the 0th position itself. So in that case the answer will be station[0]. Otherwise, if the minimum is negative, we return station[min_index + 1].