Input: n = 17, l = 1, r = 3
Output: 22
Explanation: (17)10 = (10001)2
(22)10 = (10110)2
The bits in the range 1 to 3 in the binary representation of 17 are toggled.
Input: n = 50, l = 2, r = 5
Output: 44
Explanation: (50)10 = (110010)2
(44)10 = (101100)2
The bits in the range 2 to 5 in the binary representation of 50 are toggled.
Unlock your potential with our DSA Self-Paced course, designed to help you master Data Structures and Algorithms at your own pace. In 90 days, you’ll learn the core concepts of DSA, tackle real-world problems, and boost your problem-solving skills, all at a speed that fits your schedule. With comprehensive lessons and practical exercises, this course will set you up for success in technical interviews and beyond.
And here's the challenge – join the Three 90 Challenge! Complete 90% of the course in 90 days, and you’ll earn a 90% refund. It's a great way to stay motivated, track your progress, and reward yourself for your dedication. Start the challenge today, and push your limits to achieve mastery in DSA!