Bitmask Problems

Master bitmask problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 33 problems in this category.

Total Problems: 33
Medium: 11
Hard: 22
Showing 33 of 33 problems

Problems

Scroll within this area to browse all problems

#
Title
Difficulty
698

Partition to K Equal Sum Subsets

Medium
464

Can I Win

Medium
638

Shopping Offers

Medium
877

Shortest Path Visiting All Nodes

Hard
1825

Find Minimum Time to Finish All Jobs

Hard
691

Stickers to Spell Word

Hard
526

Beautiful Arrangement

Medium
2162

Partition Array Into Two Arrays to Minimize Sum Difference

Hard
2078

Maximum Compatibility Score Sum

Medium
473

Matchsticks to Square

Medium
1587

Parallel Courses II

Hard
1471

Maximum Students Taking Exam

Hard
1531

Number of Ways to Wear Different Hats to Each Other

Hard
3649

Minimum Time to Break Locks I

Medium
3930

Longest Palindromic Path in Graph

Hard
1038

Number of Squareful Arrays

Hard
3697

Minimum Increments for Target Multiples in an Array

Hard
2114

Minimum Number of Work Sessions to Finish the Tasks

Medium
3560

Maximum Number of Moves to Kill All Pawns

Hard
3875

Maximum Good Subtree Score

Hard
3431

Find the Minimum Cost Array Permutation

Hard
980

Find the Shortest Superstring

Hard
2709

Count the Number of Square-Free Subsets

Medium
3896

Minimum Time to Transport All Individuals

Hard
1740

Count Subtrees With Max Distance Between Cities

Hard
3826

Maximum Profit from Valid Topological Order in DAG

Hard
1381

Maximum Score Words Formed by Letters

Hard
823

Split Array With Same Average

Hard
1989

Minimum XOR Sum of Two Arrays

Hard
2130

Maximum Product of the Length of Two Palindromic Subsequences

Medium
1418

Fair Distribution of Cookies

Medium
1881

Closest Subsequence Sum

Hard
2905

Count Paths That Can Form a Palindrome in a Tree

Hard

Bitmask LeetCode Problems List

  • 698. Partition to K Equal Sum Subsets - Medium - BitmaskGiven an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
  • 464. Can I Win - Medium - BitmaskIn the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first causes the running total to reach ... Topics: Math, Dynamic Programming, Bit Manipulation, Memoization, Game Theory, Bitmask
  • 638. Shopping Offers - Medium - BitmaskIn LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or mo... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
  • 877. Shortest Path Visiting All Nodes - Hard - BitmaskYou have an undirected, connected graph of n nodes labeled from 0 to n - 1. You are given an array graph where graph[i] is a list of all the nodes con... Topics: Dynamic Programming, Bit Manipulation, Breadth-First Search, Graph, Bitmask
  • 1825. Find Minimum Time to Finish All Jobs - Hard - BitmaskYou are given an integer array jobs, where jobs[i] is the amount of time it takes to complete the ith job. There are k workers that you can assign job... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 691. Stickers to Spell Word - Hard - BitmaskWe are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cu... Topics: Array, Hash Table, String, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
  • 526. Beautiful Arrangement - Medium - BitmaskSuppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 2162. Partition Array Into Two Arrays to Minimize Sum Difference - Hard - BitmaskYou are given an integer array nums of 2 * n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of t... Topics: Array, Two Pointers, Binary Search, Dynamic Programming, Bit Manipulation, Ordered Set, Bitmask
  • 2078. Maximum Compatibility Score Sum - Medium - BitmaskThere is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes). The survey was given to m students numbered f... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 473. Matchsticks to Square - Medium - BitmaskYou are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one s... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 1587. Parallel Courses II - Hard - BitmaskYou are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given an array relations where relations[i] = [... Topics: Dynamic Programming, Bit Manipulation, Graph, Bitmask
  • 1471. Maximum Students Taking Exam - Hard - BitmaskGiven a m * n matrix seats  that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is den... Topics: Array, Dynamic Programming, Bit Manipulation, Matrix, Bitmask
  • 1531. Number of Ways to Wear Different Hats to Each Other - Hard - BitmaskThere are n people and 40 types of hats labeled from 1 to 40. Given a 2D integer array hats, where hats[i] is a list of all hats preferred by the ith ... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
  • 3649. Minimum Time to Break Locks I - Medium - BitmaskBob is stuck in a dungeon and must break n locks, each requiring some amount of energy to break. The required energy for each lock is stored in an arr... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Depth-First Search, Bitmask
  • 3930. Longest Palindromic Path in Graph - Hard - BitmaskYou are given an integer n and an undirected graph with n nodes labeled from 0 to n - 1 and a 2D array edges, where edges[i] = [ui, vi] indicates an e... Topics: String, Dynamic Programming, Bit Manipulation, Graph, Bitmask
  • 1038. Number of Squareful Arrays - Hard - BitmaskAn array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, return the number of permutation... Topics: Array, Hash Table, Math, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 3697. Minimum Increments for Target Multiples in an Array - Hard - BitmaskYou are given two arrays, nums and target. In a single operation, you may increment any element of nums by 1. Return the minimum number of operations ... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Number Theory, Bitmask
  • 2114. Minimum Number of Work Sessions to Finish the Tasks - Medium - BitmaskThere are n tasks assigned to you. The task times are represented as an integer array tasks of length n, where the ith task takes tasks[i] hours to fi... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 3560. Maximum Number of Moves to Kill All Pawns - Hard - BitmaskThere is a 50 x 50 chessboard with one knight and some pawns on it. You are given two integers kx and ky where (kx, ky) denotes the position of the kn... Topics: Array, Math, Bit Manipulation, Breadth-First Search, Game Theory, Bitmask
  • 3875. Maximum Good Subtree Score - Hard - BitmaskYou are given an undirected tree rooted at node 0 with n nodes numbered from 0 to n - 1. Each node i has an integer value vals[i], and its parent is g... Topics: Array, Dynamic Programming, Bit Manipulation, Tree, Depth-First Search, Bitmask
  • 3431. Find the Minimum Cost Array Permutation - Hard - BitmaskYou are given an array nums which is a permutation of [0, 1, 2, ..., n - 1]. The score of any permutation of [0, 1, 2, ..., n - 1] named perm is defin... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
  • 980. Find the Shortest Superstring - Hard - BitmaskGiven an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of ... Topics: Array, String, Dynamic Programming, Bit Manipulation, Bitmask
  • 2709. Count the Number of Square-Free Subsets - Medium - BitmaskYou are given a positive integer 0-indexed array nums. A subset of the array nums is square-free if the product of its elements is a square-free integ... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Bitmask
  • 3896. Minimum Time to Transport All Individuals - Hard - BitmaskYou are given n individuals at a base camp who need to cross a river to reach a destination using a single boat. The boat can carry at most k people a... Topics: Array, Dynamic Programming, Bit Manipulation, Graph, Heap (Priority Queue), Shortest Path, Bitmask
  • 1740. Count Subtrees With Max Distance Between Cities - Hard - BitmaskThere are n cities numbered from 1 to n. You are given an array edges of size n-1, where edges[i] = [ui, vi] represents a bidirectional edge between c... Topics: Dynamic Programming, Bit Manipulation, Tree, Enumeration, Bitmask
  • 3826. Maximum Profit from Valid Topological Order in DAG - Hard - BitmaskYou are given a Directed Acyclic Graph (DAG) with n nodes labeled from 0 to n - 1, represented by a 2D array edges, where edges[i] = [ui, vi] indicate... Topics: Array, Dynamic Programming, Bit Manipulation, Graph, Topological Sort, Bitmask
  • 1381. Maximum Score Words Formed by Letters - Hard - BitmaskGiven a list of words, list of  single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words f... Topics: Array, String, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 823. Split Array With Same Average - Hard - BitmaskYou are given an integer array nums. You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and aver... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Bitmask
  • 1989. Minimum XOR Sum of Two Arrays - Hard - BitmaskYou are given two integer arrays nums1 and nums2 of length n. The XOR sum of the two integer arrays is (nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
  • 2130. Maximum Product of the Length of Two Palindromic Subsequences - Medium - BitmaskGiven a string s, find two disjoint palindromic subsequences of s such that the product of their lengths is maximized. The two subsequences are disjoi... Topics: String, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 1418. Fair Distribution of Cookies - Medium - BitmaskYou are given an integer array cookies, where cookies[i] denotes the number of cookies in the ith bag. You are also given an integer k that denotes th... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
  • 1881. Closest Subsequence Sum - Hard - BitmaskYou are given an integer array nums and an integer goal. You want to choose a subsequence of nums such that the sum of its elements is the closest pos... Topics: Array, Two Pointers, Dynamic Programming, Bit Manipulation, Sorting, Bitmask
  • 2905. Count Paths That Can Form a Palindrome in a Tree - Hard - BitmaskYou are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numbered from 0 to n - 1. The tree... Topics: Dynamic Programming, Bit Manipulation, Tree, Depth-First Search, Bitmask

Related LeetCode Topics

Bitmask LeetCode Problems - Interview Coder