Toggle k-th bit
Java
Medium
7 views
Problem Description
Task: toggle k-th bit and return result.
Output Format
Return value
Official Solution
static int toggleBit(int x,int k){return x ^ (1<<k);}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!