[LeetCode-Eazy] Check If N and Its Double Exist

Using Golang To Solve This Problem.

Golang

func checkIfExist(arr []int) bool {
    hash := map[int]bool{}
    count0 := 0
    for i := 0; i < len(arr); i++ {
        if arr[i] == 0 {
            count0++
        }
        hash[arr[i]*2] = true
    }
    if count0 > 1 {
        return true
    }
    for i := 0; i < len(arr); i++ {
        if hash[arr[i]] && arr[i] != 0 {
            return true
        }
    }
     
    return false
}