These questions are so hard

these questions are so hard for a beginer, I went through the course above this and even after completing that I cant understand how to solve the question. I found the answer of this question in geeksforgeeks but i still dont understand how they did it.

can you please tell me how to go through these hard questions as a beginner, some tips and tricks and how to approach these kinds of questions.

what is hash_pat and what does hash_pat[pat[i]]++ mean

@Souradeep-Kundu-824545687968212 don’t go directly to question ,first learn the hashing concept which is used in this question ,so see the video of sir first then approach the question and try to dry run your code first.

can you tell me which video of sir’s are you refferring to what us the name of the video

@Souradeep-Kundu-824545687968212 hey read from here as I don’t have acess to course.
https://www.hackerearth.com/practice/data-structures/hash-tables/basics-of-hash-tables/tutorial/