Add more test cases and add UniqueValues check

This commit is contained in:
2025-01-01 19:47:55 +01:00
parent 53aa4ab375
commit 941e9a36fb
3 changed files with 58 additions and 1 deletions

View File

@ -67,3 +67,16 @@ func GreaterThanOrEquals(value int, n int) bool {
func After(value time.Time, n time.Time) bool {
return value.After(n)
}
func UniqueValues[T comparable](values []T) bool {
seen := make(map[T]bool)
for _, value := range values {
if seen[value] {
return false
}
seen[value] = true
}
return true
}