Brute force approach gives error

I have tried a brute force approach to this question, but i am getting a wrong output, can please tell me where i am doing wrong in my program?

code link:-https://drive.google.com/file/d/1h0gre85JXQwOTln9E-P78EmwLUczdTGk/view?usp=sharing

You are only checking for first meeting and don’t increment k!
dont return true unless k==n,
also this way will not be accepted, think when max_ = 10^9, then you cannot make such large array!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.