# ARRAY\_OPS Editorial

**URL:** <https://discuss.codechef.com/t/array-ops-editorial/100450>\
**Category:** editorial\
**Tags:** array, easy-medium, editorial, start33\
**Created:** [April 6, 2022, 5:51pm UTC](https://discuss.codechef.com/t/array-ops-editorial/100450 "2022-04-06T17:51:11Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![aryanc403](https://discuss.codechef.com/user_avatar/discuss.codechef.com/aryanc403/32/215126_2.png) [@aryanc403](https://discuss.codechef.com/u/aryanc403)\
**Post date:** [April 7, 2022, 12:48pm UTC](https://discuss.codechef.com/t/array-ops-editorial/100450/6 "2022-04-07T12:48:10Z")

</div>

I did it like this -

Let M1 be the MSB of all nos. After one iteration atmax one no would have M1 on. Leaving proof as an exercise for readers. Shouldnt be difficult.

After first iteration, lets ignore the largest no.  
Let M2 be the MSB of all except the largest no.  
After second iteration atmax one no among smallest to second largest would have M2 on.  
…  
Inductively, we can see that after O(logC) iterations there would be atmax logC non zero elements.

---

_[View the full topic](https://discuss.codechef.com/t/array-ops-editorial/100450)._
