Add more test cases and add UniqueValues check
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user