LeetCode 1356: Sort by Number of 1 Bits 🧮
Solve LeetCode 1356 to sort integers by their count of 1 bits using bit manipulation. Easy problem with clear solution.

codestorywithMIC
4 views • Feb 25, 2026

About this video
LeetCode Problem 1356 – Sort Integers by The Number of 1 Bits
Difficulty: Easy
In this video, we solve LeetCode 1356 where the task is to sort an array of integers based on
the number of 1s in their binary representation.
Sorting Rules:
1. Numbers with fewer set bits come first
2. If two numbers have the same number of set bits, sort them in ascending order
Approach:
- Count set bits for each number
- Use custom sorting based on bit count and value
- Apply efficient bit manipulation logic
Concepts Covered:
- Bit manipulation
- Counting set bits
- Custom comparator
- Sorting techniques
Time Complexity: O(n log n)
Space Complexity: O(n)
This problem helps in:
• Understanding binary representation
• Practicing bit manipulation
• Strengthening sorting concepts
• Interview and DSA preparation
Subscribe to codestorywithMIC for:
Daily LeetCode solutions
DSA explained simply
Coding interview preparation
Shorts + long form coding content
Every problem has a story — keep coding 💻🔥
#codestorywithMIC #LeetCode #LeetCode1356 #DSA
#BitManipulation #Binary #Sorting
#Coding #ProblemSolving #interviewpreparation
Difficulty: Easy
In this video, we solve LeetCode 1356 where the task is to sort an array of integers based on
the number of 1s in their binary representation.
Sorting Rules:
1. Numbers with fewer set bits come first
2. If two numbers have the same number of set bits, sort them in ascending order
Approach:
- Count set bits for each number
- Use custom sorting based on bit count and value
- Apply efficient bit manipulation logic
Concepts Covered:
- Bit manipulation
- Counting set bits
- Custom comparator
- Sorting techniques
Time Complexity: O(n log n)
Space Complexity: O(n)
This problem helps in:
• Understanding binary representation
• Practicing bit manipulation
• Strengthening sorting concepts
• Interview and DSA preparation
Subscribe to codestorywithMIC for:
Daily LeetCode solutions
DSA explained simply
Coding interview preparation
Shorts + long form coding content
Every problem has a story — keep coding 💻🔥
#codestorywithMIC #LeetCode #LeetCode1356 #DSA
#BitManipulation #Binary #Sorting
#Coding #ProblemSolving #interviewpreparation
Video Information
Views
4
Likes
1
Duration
10:41
Published
Feb 25, 2026
Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.