You must ride n trains of distances dist[i]. All trains except the last depart at integer hours. Find the minimum integer speed to arrive on time (within `hour` hours). Return -1 if impossible.
Binary search on speed in [1, 10^7]. For a given speed, compute total time: sum(ceil(dist[i]/speed)) for all but last, plus dist[n-1]/speed for the last train.
- lo=1, hi=10^7 (max constraint).
- For mid speed: time = sum(ceil(dist[i]/mid)) for i
- If time <= hour: hi=mid (try slower).
- Else: lo=mid+1.
- If even at max speed arrival is impossible, return -1.
- Time Complexity: O(N log(10^7))
- Space Complexity: O(1)