2 students didn't borrow, so total students who borrowed is 28

Average number of books per student is 2

So total books borrowed is 28x2=56

12 students borrowed each 1 book, so total book these students took= 12 book

10 students borrowed each 2 books, so total book these students took= 20 book

Total book borrowed by above two group of students= 12+20=32

Remaining books available= 56-32= 24

remaining students=28-22=6

6 students borrowed atleast 3 books

to calculate max books one student could have take, let's assume all other 5 students took 3 book each

so 5x3= 15 books

So the 6th student will have 24-15= 9 books(ans)

I hope the explanation is detailed enough