CodeTon Round 4 Ques 2 (explanation needed)

Revision en1, by SharanyaRMannan, 2023-03-31 20:32:46

hi i was just going thru the editorial of the contest, and was wondering the functionality of this LOOP:

for(int i = 29;i >= 1;i--) { if((n >> i) & 1) { f = 1; v.push_back(2); } else if(f) { v.push_back(1); } }

in ques 2 of the contest..

can anyone help me with this..?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English SharanyaRMannan 2023-03-31 20:32:46 398 Initial revision (published)