Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Minimum Speed to Arrive on Time

Difficulty: Medium

Acceptance: 69.00%

Points: 30.00

You are given an array dist where dist[i] represents the distance of the ith train ride, and a floating-point number hour representing the total time available. Each train can only depart at an integer hour. This means after finishing a train ride, you may need to wait until the next integer hour before starting the next train, except for the last train which does not require waiting. Return the minimum integer speed required to travel all distances within the given hour. If it is not possible to arrive on time, return -1.

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 = dist.length = 105
  • 1 = dist[i] = 105
  • 1 = hour = 10?
  • hour can have up to two decimal places
Companies:
Samsung
Topics:
Binary Search
Locked Content
Access Restricted: Please Login to access the code editor and test cases.