Pergunta de entrevista da empresa Trimble

In tech interview I was given with an array of integers and asked to find the missing number in the array. For example, if array is [1,3,4,5] then 2 is the output.