Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 09ab7f1

Browse files
authoredSep 22, 2022
Update 774-minimize-max-distance-to-gas-station.js
1 parent ff72fce commit 09ab7f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎774-minimize-max-distance-to-gas-station.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const minmaxGasDist = function (stations, K) {
2424
const possible = (dis, res, K) => {
2525
let need = 0
2626
for (let i = 0; i < dis.length; i++) {
27-
need += Math.floor(dis[i] / res)
27+
need += dis[i] <= res ? 0 : Math.floor(dis[i] / res)
2828
}
2929
return need <= K
3030
}

0 commit comments

Comments
 (0)
Please sign in to comment.