Dsa
Bit Manipulation
Medium
Flip Nth Bit
Write a program that reads a positive integer and a position N (0-indexed from the right) and flips the Nth bit of the number. Print the new number after the bit has been flipped.
Example:
Input:
5 1
Output:
7
Key concepts
bit_manipulationflipping
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now