remove useless for loop

This commit is contained in:
David 2020-12-13 13:01:44 -05:00
parent 18bccde2f5
commit e2ac00420d

View File

@ -74,18 +74,15 @@ func partTwo() {
t := float64(0)
offset := buses[0].route
for {
loop:
t = t + offset
offset = 1
for i := range buses {
if math.Remainder(t+buses[i].offset, buses[i].route) != 0 {
goto loop
} else {
offset = offset * buses[i].route
}
loop:
t = t + offset
offset = 1
for i := range buses {
if math.Remainder(t+buses[i].offset, buses[i].route) != 0 {
goto loop
} else {
offset = offset * buses[i].route
}
break
}
fmt.Println(int(t))