Help in problem TRIP2

I made the submission intended for only passing the Sub task 1.
Problem Link: link
My Submission:link
Someone please help, whats wrong with it.
Thanks in Advance.

Unable to understand your code well.
https://www.codechef.com/viewsolution/29150895
Here’s my code. My solution is just simply generate an array of 1,2,1,2…
and another array of 2,1,2,1 and check array with both of them and see if pattern matches in any of them where a[i]!=-1.

1 Like

That’s a very nice approach. Thanks

1 Like