(nums []int)
| 1 | package contains_duplicate_217 |
| 2 | |
| 3 | func containsDuplicate(nums []int) bool { |
| 4 | m := make(map[int]bool) |
| 5 | for _, n := range nums { |
| 6 | if m[n] { |
| 7 | return true |
| 8 | } |
| 9 | |
| 10 | m[n] = true |
| 11 | } |
| 12 | |
| 13 | return false |
| 14 | } |
| 15 | |
| 16 | /* |
| 17 | Note: bit shifting technique only worked for n > -1 in nums |
no outgoing calls