Explain Arithmetic vs Logical Right Shift
Updated Apr 28, 2026
Short answer
Arithmetic preserves the sign bit; logical fills with zero.
Deep explanation
This explores bitwise arithmetic and identity properties. Arithmetic preserves the sign bit; logical fills with zero. These patterns are common in technical coding interviews.
Real-world example
Efficient memory allocation alignment checks.
Common mistakes
- Not handling the case where n = 0 for power-of-two checks.
Follow-up questions
- What is the time complexity?