Files
2019/utilities/array.go
Parnic d7db069031 Day 6 solution
I'm reasonably happy with this. I started with a bi-directional linked list, but realized that a flat list of all nodes came in handy for one use case while the linked list came in handy for another, so I settled on that.
2022-06-12 13:37:36 -05:00

13 lines
241 B
Go

package utilities
// ArrayContains returns whether the specified array contains the specified value
func ArrayContains[T comparable](array []T, val T) bool {
for _, v := range array {
if v == val {
return true
}
}
return false
}