use x := range and y := range, easier to read.

This commit is contained in:
2025-01-08 05:42:35 +00:00
parent 75d10fffd0
commit 5d6d8fdf79
4 changed files with 12 additions and 12 deletions

View File

@@ -15,9 +15,9 @@ func Solve(buf []byte) (int, error) {
var totalCost int
totalAreaVisited := make(map[point]struct{})
for i := 0; i < len(graph.data); i++ {
for j := 0; j < len(graph.data[i]); j++ {
start := newPoint(j, i)
for y := range graph.data {
for x := range graph.data[y] {
start := newPoint(x, y)
if graph.isOutOfBounds(start) {
continue
}

View File

@@ -15,9 +15,9 @@ func Solve(buf []byte) (int, error) {
var totalCost int
totalAreaVisited := make(map[point]struct{})
for i := 0; i < len(graph.data); i++ {
for j := 0; j < len(graph.data[i]); j++ {
start := newPoint(j, i)
for y := range graph.data {
for x := range graph.data[y] {
start := newPoint(x, y)
if graph.isOutOfBounds(start) {
continue
}