The best answer here is very much in detail
Answer-D
Smart step for this question is to look this
This clearly says that if count !=0, then we have to return false,
This means, if two strings have matched successfully, our count should be zero so that we will get count[j]=0 at the end of our computation
Now look each option one by one, you will find that
Option D is the only candidate for this kind of operation.
What we are doing is
We are adding the ascii values of each character in string A, and subtracting the ascii value of each character in string B.
In this code, we are moving one step by step, and incrementing the j smartly in the second count[b[j++]]—
So clearly you have to visualize these kind of questions
Thanks