Skip to content

Instantly share code, notes, and snippets.

View artiga033's full-sized avatar
🐟
/await

artiga033

🐟
/await
View GitHub Profile
@bgadrian
bgadrian / set.go
Last active April 23, 2024 13:50
How to implement a simple set data structure in golang
type Set struct {
list map[int]struct{} //empty structs occupy 0 memory
}
func (s *Set) Has(v int) bool {
_, ok := s.list[v]
return ok
}