adaptatron's blog

By adaptatron, 3 months ago, In English

I created a video discussing how to compute the XOR of all numbers in the range $$$[L, R]$$$ in $$$O(1)$$$. It also talks about how to compute the number of set bits at position $$$p$$$ in the range $$$[L, R]$$$ (people usually get confused with off-by-one errors in these problems, Not anymore!).

Although not directly related, XORs and modulo 4 appeared in the last Codeforces Round. This trick is not known by many, so I decided to create a video.

https://youtu.be/v8G2gjQ_gp8?si=rG60v07Bn4mTL-dw

If you want to apply this info to an actual problem, here's a practice contest https://codeforces.me/group/7Dn3ObOpau/contest/539212

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Update : I also created a practice contest https://codeforces.me/group/7Dn3ObOpau/contest/539212