Search
⌘K

Leetcode 1870. Minimum Speed to Arrive on Time

Find the minimum positive integer speed such that, when intermediate trains can only depart at integer hours (so each of the first n-1 rides contributes ceil(dist[i]/speed) hours and the last ride contributes dist[n-1]/speed hours), the total commute time ≤ hour; return -1 if no such speed exists. This is a monotonic feasibility check over speed (suitable for binary search).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.