Day01 - code restructure

This commit is contained in:
2024-12-09 01:35:23 +01:00
parent 2cda847908
commit e6fdf88f0d
3 changed files with 5 additions and 2 deletions

View File

@@ -11,8 +11,7 @@ func main() {
fmt.Printf("|| AdventOfCode 2024 - Day %02d ||\n", DAY)
fmt.Println("||++++++++++++++++++++++++++++||\n")
fmt.Println("Original Code")
original()
fmt.Println("\nOptimized Code by ChatGPT")
fmt.Println()
optimized()
}

View File

@@ -9,6 +9,8 @@ import (
)
func optimized() {
fmt.Println("Optimized Code by ChatGPT")
// Read the file in one step
content, err := os.ReadFile("./input.json")
if err != nil {

View File

@@ -9,6 +9,8 @@ import (
)
func original() {
fmt.Println("Original Code")
content, err := ioutil.ReadFile("./input.json")
if err != nil {
log.Fatal("Error when opening input.json: ", err)