Dsa
Bit Manipulation
Medium
Bit Count Comparison
You are given two integers, A and B. Your task is to determine if the number of set bits (1s in the binary representation) in A is greater than the number of set bits in B. Print 'Greater', 'Less', or 'Equal' based on the count of set bits.
Input:
Two integers A and B, separated by a space.
Output:
'Greater' if A has more set bits than B, 'Less' if A has fewer set bits than B, or 'Equal' if they have the same number of set bits.
Example:
Input:
5 3
Output:
Greater
Key concepts
bit_manipulationcounting
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