Whenever this type of question came, related to resource and deadlock or process and deadlock the simple way to solve is
Allocate each process a resource equal to their maximum need - 1, This type of allocation gives you maximum no resources that lead to deadlock but if you just add 1 to this number you will get minimum no of resources causing no deadlock.
for example
let us say the total no of resources is R and we have to N process and each can take almost M resource the what is the value of N?
N * (M-1) + 1 <= R
for this question, the maximum no of processes is 5 without deadlock, the minimum no of the process causing deadlock is 6 but it is not given in option so go with 4