Since it's a hard question and my solution is so simple, does boolean[n] use O(n) space or O(1) space?

```
public int findDuplicate(int[] nums){
boolean[] arr = new boolean[nums.length+1];
for(int i=0;i<nums.length;i++){
if(arr[nums[i]]){
return nums[i];
}else{
arr[nums[i]]=true;
}
}
return 0;
}
```