Basic Bit Operations


  • Set bit: n |= 1 << i
  • Clear bit: n &= ~(1<<i)
  • Test bit: (n>>i) & 1
  • Clear last 1: n & (n - 1)

评论

此博客中的热门博文

776. Split BST

663. Equal Tree Partition

532. K-diff Pairs in an Array