From 21cf07023300be6c971c0e4f792114b99df9d8c8 Mon Sep 17 00:00:00 2001 From: Flashk Date: Mon, 9 Dec 2024 17:26:11 +0100 Subject: [PATCH] refactor: minor line adjustments --- .../java/com/adventofcode/flashk/day09/DiskFragmenter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/adventofcode/flashk/day09/DiskFragmenter.java b/src/main/java/com/adventofcode/flashk/day09/DiskFragmenter.java index 49151ed..ec08155 100644 --- a/src/main/java/com/adventofcode/flashk/day09/DiskFragmenter.java +++ b/src/main/java/com/adventofcode/flashk/day09/DiskFragmenter.java @@ -9,11 +9,13 @@ public class DiskFragmenter { private final Deque diskDeque = new ArrayDeque<>(); public DiskFragmenter(List inputs) { - char[] diskMap = inputs.get(0).toCharArray(); + char[] diskMap = inputs.get(0).toCharArray(); int fileId = 0; int lastBlockIndex = 0; + for(int i = 0; i < diskMap.length; i++) { + int blockSize = Character.getNumericValue(diskMap[i]); for(int blockIndex = lastBlockIndex; blockIndex < lastBlockIndex + blockSize; blockIndex++) {