Hello, I’m wondering about the part of the problem where we are comparing with the value of `nums[j]`

. In the example, `[4, 0, 3, 1]`

, the value i starts at zero. But the value at `nums[i]`

will give us an index for j, which is out of bounds. Here’s how I"m walking through it.

`i = 0, then j = nums[i] which is 4`

Then in the if-statement, we have a comparison involving `nums[j]`

, in this case, it’s `nums[4]`

which is out of bounds, since the array only goes up to index 3. In the if-statement, is `nums[j]`

treated as `None`

(or `null`

)? So we’re comparing nums[i] to None (or null)?

Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively

Lesson: Find the Missing Number (easy) - Grokking the Coding Interview: Patterns for Coding Questions