help in a codeforce question.

Did u consider the edge cases like when r-l<=2,also changing at l and r

This is my ac code :

http://codeforces.com/contest/935/submission/36069836

see if u understand it.

If u dont,tell me.I’ll explain when i get time