From c8a48c91c97527954be9f5fc4f011a702bcd7152 Mon Sep 17 00:00:00 2001 From: shizophrenicgopher Date: Fri, 12 Dec 2025 09:06:25 +0100 Subject: [PATCH 1/2] Day One with go --- Day-01/go/artur/day01.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Day-01/go/artur/day01.go diff --git a/Day-01/go/artur/day01.go b/Day-01/go/artur/day01.go new file mode 100644 index 0000000..f54b010 --- /dev/null +++ b/Day-01/go/artur/day01.go @@ -0,0 +1,35 @@ +package main + +import ( + "os" + "strconv" + "strings" +) + +func main() { + input, _ := os.ReadFile("Day-01/go/artur/input.txt") + lines := strings.Split(string(input), "\n") + + countP1 := 0 + countP2 := 0 + dial := int64(50) + for _, line := range lines { + increase, _ := strconv.ParseInt(line[1:], 10, 64) + + for ; increase != 0; increase-- { + if line[0] == 'R' { + dial = (dial + 1) % 100 + } else { + dial = (dial - 1) % 100 + } + if dial == 0 { + countP2++ + } + } + if dial == 0 { + countP1++ + } + } + println(countP1) + println(countP2) +} From 6d133d06e5a70ed658ee6c07bd6da6c2dbb8e4ab Mon Sep 17 00:00:00 2001 From: shizophrenicgopher Date: Fri, 12 Dec 2025 14:31:32 +0100 Subject: [PATCH 2/2] Day Two Part One in go --- Day-02/go/artur/day02.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Day-02/go/artur/day02.go diff --git a/Day-02/go/artur/day02.go b/Day-02/go/artur/day02.go new file mode 100644 index 0000000..a5bfa74 --- /dev/null +++ b/Day-02/go/artur/day02.go @@ -0,0 +1,28 @@ +package main + +import ( + "os" + "strconv" + "strings" +) + +func main() { + input, _ := os.ReadFile("Day-02/go/artur/input.txt") + doubleIds := strings.Split(string(input), ",") + result := 0 + for _, idRange := range doubleIds { + idSplit := strings.Split(idRange, "-") + id1, _ := strconv.Atoi(idSplit[0]) + id2, _ := strconv.Atoi(idSplit[1]) + for ; id1 <= id2; id1++ { + id1String := strconv.Itoa(id1) + if len(id1String)%2 == 1 { + continue + } + if id1String[:len(id1String)/2] == id1String[len(id1String)/2:] { + result += id1 + } + } + } + println(result) +}