Help with CSES Collecting Numbers II

What’s the idea of solving this? And also an AC code. CSES - Collecting Numbers II

3 Likes