https://leetcode.com/problems/single-number/
int singleNumber(int* nums, int numsSize){
int* intArray = (int*) calloc(600000, sizeof(int));
for(int i = 0; i < numsSize; i++){
intArray[nums[i]+300000]++;
}
for(int i = 0; i < 600000; i++){
if(intArray[i] == 1){
free(intArray);
return i-300000;
}
}
free(intArray);
return 0;
}```
Learning syntax, algos and just general C stuff as I do these leetcode problems so there's likely a better way to do this.
Looking for some instructive feedback for any glaring mistakes.
I'm assuming there's a much more memory friendly solution I can't think of 8)