Open SaivijayK opened 2 years ago
can we change line 18 where element of array is compared with undefined?
@chhaviteotia in this problem we are checking whether the number is occurring first time or its already occurred, so for solving that kind of problem, we need to use undefined
@LVSsandeepVarma yes i can write the code in O(1) space, but this question belongs to topic ARRAY, so that's the reason why, i have used Array in the code, do you want me to do in O(1) space, without using any array?
@LVSsandeepVarma yes i can write the code in O(1) space, but this question belongs to topic ARRAY, so that's the reason why, i have used Array in the code, do you want me to do in O(1) space, without using any array?
@SaivijayK ok in that case then it's better with array only
Checklist
Note:
Please copy only the solution part. Do not copy/paste the template code. That way, any issues with template code can be caught early on.