shengzhang514 / LeetCodeGroup

0 stars 0 forks source link

Week 18 #27

Open lancevalour opened 5 years ago

lancevalour commented 5 years ago
lancevalour commented 5 years ago

Since it's 1 - N, we can mark the element at index i, where i is the value of the array at a certain index. If we have the duplicate, we will mark the same element multiple times. The one we didn't mark, it's index is the missing number.

We will mark it to be negative or anything that can be differentiated from others.