The sum of the maximum requirement of the processes is $Q1 + Q2 + Q3 + ........ + Qn.$
Number of minimum resources are needed to ensure deadlock doesn't occur, sum all the maximum requirements of all the processes and subtract 1 from each and then give one more resource any of the processes:
$[(Q1-1) + (Q2-1) + (Q3-1) + ........ + (Qn-1)] +1$
which is $(Q1 + Q2 + Q3 + ........ + Qn) - N + 1$
Hence, option (D) is correct!