1
0
Fork 0
mirror of https://github.com/Luzifer/aoc2019.git synced 2024-12-22 05:51:16 +00:00
aoc2019/helpers.go
Knut Ahlers c5e14ed7f4
Add solution for Day 10
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2019-12-10 16:22:53 +01:00

16 lines
254 B
Go

package aoc2019
import "math"
func greatestCommonDivisor(a, b int64) int64 {
for b != 0 {
t := b
b = a % b
a = t
}
return a
}
func manhattenDistance(x1, y1, x2, y2 int) int {
return int(math.Abs(float64(x1-x2)) + math.Abs(float64(y1-y2)))
}