Try doing it on paper first. What numbers are missing from { 5 2 8 1 10 3 7 4 }?
How did you work it out? OK, if you looked for 1, then 2, then 3 etc, that's inefficient. Work it out again starting at the first element in the array, looking at each element only once.

Hint: You can take notes. For example, how might you keep track of the fact that you've seen a 5 after processing the first element?