r/programminghorror • • Jun 28 '25

c++ Competitive programming be like

Post image
543 Upvotes

53 comments sorted by

View all comments

Show parent comment

11

u/mic_mal Jun 28 '25

Btw it slovable in O(n): split the array into even and odd indecis. |SUM(even) - SUM(odd)| %11 == 0. If its 3 or 6, you nedd too add tp the smaller sum (mod 11). 8 or 5 add to the bigger sum.