2023 Day 5 Complete!
This commit is contained in:
@@ -389,6 +389,18 @@ func IsPrime(value int) bool {
|
||||
return value > 1
|
||||
}
|
||||
|
||||
func SliceMin(sl []int) int {
|
||||
switch len(sl) {
|
||||
case 0:
|
||||
return MIN_INT
|
||||
case 1:
|
||||
return sl[0]
|
||||
case 2:
|
||||
return Min(sl[0], sl[1])
|
||||
default:
|
||||
return Min(sl[0], sl[1], sl[2:]...)
|
||||
}
|
||||
}
|
||||
func Min(v1, v2 int, vrest ...int) int {
|
||||
min := v2
|
||||
if v1 < v2 {
|
||||
|
Reference in New Issue
Block a user