DEV Community

Discussion on: Solution: Missing Number

Collapse
 
seanpgallivan profile image
seanpgallivan • Edited

The code is very readable, which is good, but indexOf() is an O(n) time function by itself, so the overall time complexity becomes O(n^2), and the space complexity becomes O(n) since you're creating a new array (original).

Collapse
 
nithish_13 profile image
Nithish Kumar

Thank you for explaining... Even though I'm not good at Big O notation, I can understand ur explanation.