I am getting this error while solving problem(217.Contains Duplicate) on leetcode
AddressSanitizer:DEADLYSIGNAL
=================================================================
==33==ERROR: AddressSanitizer: stack-overflow on address 0x7ffed3a8f0d8 (pc 0x0000003454ba bp 0x7fff8d5591f0 sp 0x7ffed3a8f0e0 T0)
#2 0x7f8de24cc0b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
==33==ABORTING
This is my code:
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
long long int n=2*1e9+10;
long long int hsh[n];
for (int i=0;i<sizeof(nums);++i){
hsh[nums[i]+n]++;
}
int ok=0;
for(int i=0;i<n;++i){
if(hsh[i]>1){
ok=1;
break;
}
}
if(ok==1){return true;}
else{return false;}
}
};