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.
That should be "total fuel is LESS than the distance to be covered" so there's no solution. The problem guarantees a solution for given data so this data (total fuel = 19, total distance = 25) does not qualify. There is always a solution if (total fuel >= total distance) but no solution if (total fuel < total distance).
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 →
That should be "total fuel is LESS than the distance to be covered" so there's no solution. The problem guarantees a solution for given data so this data (total fuel = 19, total distance = 25) does not qualify. There is always a solution if (total fuel >= total distance) but no solution if (total fuel < total distance).