Bitmask LeetCode Problems: All 43,
With Python Solutions

Every problem in this library that LeetCode tags Bitmask. 35 of them carry a complete Python solution, a worked example and the time and space complexity of the approach.

Easy
0
Medium
16
Hard
27
1 pattern

How Bitmask problems are solved

A tag names the subject, not the method. These pattern hubs cover the techniques that actually solve Bitmask problems — each one explains the approach, gives a Python template and states its complexity.

Eyes only

When the Bitmask problem arrives live.

In the live round, Stealth Interview reads the problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer says. It's a desktop app for macOS and Windows, invisible to screen sharing.

Bitmask problems by difficulty

Problems with a complete Python solution are listed first, then by ascending problem number.

Medium (16)

Medium problems
No.Problem
0464Can I Win
0473Matchsticks to Square
0526Beautiful Arrangement
0638Shopping Offers
0698Partition to K Equal Sum Subsets
1947Maximum Compatibility Score Sum
1986Minimum Number of Work Sessions to Finish the Tasks
2002Maximum Product of the Length of Two Palindromic Subsequences
2305Fair Distribution of Cookies
2572Count the Number of Square-Free Subsets
2741Special Permutations
0351Android Unlock PatternsPremium
1066Campus Bikes IIPremium
2152Minimum Number of Lines to Cover PointsPremium
2184Number of Ways to Build Sturdy Brick WallPremium
2992Number of Self-Divisible PermutationsPremium

Hard (27)

Hard problems
No.Problem
0691Stickers to Spell Word
0805Split Array With Same Average
0847Shortest Path Visiting All Nodes
0943Find the Shortest Superstring
0996Number of Squareful Arrays
1125Smallest Sufficient Team
1255Maximum Score Words Formed by Letters
1349Maximum Students Taking Exam
1434Number of Ways to Wear Different Hats to Each Other
1494Parallel Courses II
1595Minimum Cost to Connect Two Groups of Points
1617Count Subtrees With Max Distance Between Cities
1655Distribute Repeating Integers
1659Maximize Grid Happiness
1681Minimum Incompatibility
1723Find Minimum Time to Finish All Jobs
1755Closest Subsequence Sum
1799Maximize Score After N Operations
1815Maximum Number of Groups Getting Fresh Donuts
1879Minimum XOR Sum of Two Arrays
1994The Number of Good Subsets
2035Partition Array Into Two Arrays to Minimize Sum Difference
2172Maximum AND Sum of Array
2791Count Paths That Can Form a Palindrome in a Tree
0465Optimal Account BalancingPremium
2247Maximum Cost of Trip With K HighwaysPremium
2403Minimum Time to Kill All MonstersPremium