add duration output

This commit is contained in:
David 2020-12-11 21:57:10 -05:00
parent 9244b2e178
commit 24b59f71fa
11 changed files with 55 additions and 0 deletions

View File

@ -5,11 +5,16 @@ import (
"fmt" "fmt"
"os" "os"
"strconv" "strconv"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
// [...] they need you to find the two entries that sum to 2020 and then multiply those two numbers together. // [...] they need you to find the two entries that sum to 2020 and then multiply those two numbers together.

View File

@ -6,12 +6,17 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
"unicode" "unicode"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
//To try to debug the problem, they have created a list (your puzzle input) of passwords (according to the corrupted database) and the corporate policy when that password was set. //To try to debug the problem, they have created a list (your puzzle input) of passwords (according to the corrupted database) and the corporate policy when that password was set.

View File

@ -5,11 +5,16 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
type slope struct { type slope struct {

View File

@ -6,11 +6,16 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
type passport struct { type passport struct {

View File

@ -5,11 +5,16 @@ import (
"fmt" "fmt"
"os" "os"
"sort" "sort"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
type boardingPass struct { type boardingPass struct {

View File

@ -5,11 +5,16 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
func union(s string) string { func union(s string) string {

View File

@ -6,11 +6,16 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
// Bag is a bag that contains other bags // Bag is a bag that contains other bags

View File

@ -6,11 +6,16 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
type opCode struct { type opCode struct {

View File

@ -6,11 +6,16 @@ import (
"os" "os"
"sort" "sort"
"strconv" "strconv"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
func checkNotSum(t int, s []int) bool { func checkNotSum(t int, s []int) bool {

View File

@ -6,11 +6,16 @@ import (
"os" "os"
"sort" "sort"
"strconv" "strconv"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
// Find a chain that uses all of your adapters to connect the charging outlet to your device's built-in adapter // Find a chain that uses all of your adapters to connect the charging outlet to your device's built-in adapter

View File

@ -4,11 +4,16 @@ import (
"bufio" "bufio"
"fmt" "fmt"
"os" "os"
"time"
) )
func main() { func main() {
start := time.Now()
partOne() partOne()
duration := time.Since(start)
partTwo() partTwo()
duration2 := time.Since(start)
fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
} }
type cell struct { type cell struct {