Merge pull request #2539 from yawebNW/master

Update 0332.重新安排行程.md 更新java版本
This commit is contained in:
程序员Carl
2024-05-19 09:29:27 +08:00
committed by GitHub

View File

@ -379,6 +379,8 @@ class Solution {
String targetLocation;
//遍历从当前位置出发的机票
for (int i = 0; i < targetLocations.size(); i++) {
//去重,否则在最后一个测试用例中遇到循环时会无限递归
if(i > 0 && targetLocations.get(i).equals(targetLocations.get(i - 1))) continue;
targetLocation = targetLocations.get(i);
//删除终点列表中当前的终点
targetLocations.remove(i);