diff --git "a/LeetCode/2031-2040/2039. \347\275\221\347\273\234\347\251\272\351\227\262\347\232\204\346\227\266\345\210\273\357\274\210\344\270\255\347\255\211\357\274\211.md" "b/LeetCode/2031-2040/2039. \347\275\221\347\273\234\347\251\272\351\227\262\347\232\204\346\227\266\345\210\273\357\274\210\344\270\255\347\255\211\357\274\211.md" index 0be1a213..7fb1228f 100644 --- "a/LeetCode/2031-2040/2039. \347\275\221\347\273\234\347\251\272\351\227\262\347\232\204\346\227\266\345\210\273\357\274\210\344\270\255\347\255\211\357\274\211.md" +++ "b/LeetCode/2031-2040/2039. \347\275\221\347\273\234\347\251\272\351\227\262\347\232\204\346\227\266\345\210\273\357\274\210\344\270\255\347\255\211\357\274\211.md" @@ -118,11 +118,11 @@ class Solution { d.addLast(j); } } - int ans = -1; + int ans = 0; for (int i = 1; i < n; i++) { int di = dist[i] * 2, t = patience[i]; int cur = di <= t ? di : (di - 1) / t * t + di; - if (ans == -1 || cur > ans) ans = cur; + if (cur > ans) ans = cur; } return ans + 1; }