How to implement code

I observed the pattern of input and output of below question but don’t know how to write code for it,
Please help!
https://www.codechef.com/problems/TRISQ

easy implementation:-
https://www.codechef.com/viewsolution/29208237

1 Like