From 0c2736565bf94f1e6287a6871b2c2ac36a679846 Mon Sep 17 00:00:00 2001 From: Lucien-Hsu <56381401+Lucien-Hsu@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:08:34 +0800 Subject: [PATCH] Correct index update logic in gas station problem solution in Java - Fix index calculation in gas station problem solution. - Fix java code block display. --- "problems/0134.\345\212\240\346\262\271\347\253\231.md" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" index 5c8b0c3cc8..f80cbd441d 100755 --- "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" +++ "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" @@ -238,7 +238,7 @@ class Solution { curSum += gas[i] - cost[i]; totalSum += gas[i] - cost[i]; if (curSum < 0) { - index = (i + 1) % gas.length ; + index = (i + 1); curSum = 0; } } @@ -247,7 +247,7 @@ class Solution { } } ``` -``` +```java // 解法3 class Solution { public int canCompleteCircuit(int[] gas, int[] cost) {