Try to find requirement of each process

Requirement is as follows :

p0 = 01002

p1 = 02100

p3 = 10300

p4 = 00111

Now try to allocate the resources, if X = 1then it will satisfy need of p4 and then resources of p4 will get freed up

Hence new availability = 11221. But then it doesn't satisfy any requirement hence unsafe state when x= 1.

Try **x =2** it will satisfy all requirement. Hence answer is X =2.