Can anyone help me why I am getting a runtime error (BOOKCHEF)

question link —>
my solution ----->

Line no 37 and 41. You might be going out of bounds.

1 Like

Consider the testcase:

1 5
5 1 hello
5 2 hello1
5 3 hello2
5 4 hello3
5 5 hello4

1 Like

Thank you thank you so much for saving my hours to come to this test case.Finally I got the correct answer.
Mistake I was doing:
It was not necessary in this question that one person can have only one post . It may be possible that all posts are from him and even he posts nothing.This minor but important thing I missed.
Once again thank you for saving my efforts which I made on my previous code.

1 Like

Yes I got it now. Thanks for replying:)