leetcode.cn 2023-06-20
🔴1595.minimum-cost-to-connect-two-groups-of-points
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask #matrix
🔴1595.minimum-cost-to-connect-two-groups-of-points
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask #matrix
Telegraph
minimum-cost-to-connect-two-groups-of-points
给你两组点,其中第一组中有 size1 个点,第二组中有 size2 个点,且 size1 >= size2 。 任意两点间的连接成本 cost 由大小为 size1 x size2 矩阵给出,其中 cost[i][j] 是第一组中的点 i 和第二组中的点 j 的连接成本。如果两个组中的每个点都与另一组中的一个或多个点连接,则称这两组点是连通的。换言之,第一组中的每个点必须至少与第二组中的一个点连接,且第二组中的每个点必须至少与第一组中的一个点连接。 返回连通两组点所需的最小成本。 示例 1: 输入:cost…
leetcode.cn 2023-06-24
🔴1659.maximize-grid-happiness
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming #bitmask
🔴1659.maximize-grid-happiness
🏷️ Tags
#bit_manipulation #memoization #dynamic_programming #bitmask
Telegraph
maximize-grid-happiness
给你四个整数 m、n、introvertsCount 和 extrovertsCount 。有一个 m x n 网格,和两种类型的人:内向的人和外向的人。总共有 introvertsCount 个内向的人和 extrovertsCount 个外向的人。 请你决定网格中应当居住多少人,并为每个人分配一个网格单元。 注意,不必 让所有人都生活在网格中。 每个人的 幸福感 计算如下:
leetcode.cn 2023-06-28
🔴1681.minimum-incompatibility
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask
🔴1681.minimum-incompatibility
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask
Telegraph
minimum-incompatibility
给你一个整数数组 nums 和一个整数 k 。你需要将这个数组划分到 k 个相同大小的子集中,使得同一个子集里面没有两个相同的元素。 一个子集的 不兼容性 是该子集里面最大值和最小值的差。 请你返回将数组分成 k 个子集后,各子集 不兼容性 的 和 的 最小值 ,如果无法分成分成 k 个子集,返回 -1 。 子集的定义是数组中一些数字的集合,对数字顺序没有要求。 示例 1: 输入:nums = [1,2,1,4], k = 2 输出:4 解释:最优的分配是 [1,2] 和 [1,4] 。 不兼容性和为…
leetcode.com 2023-07-01
🟡2305.fair-distribution-of-cookies
🏷️ Tags
#bit_manipulation #array #dynamic_programming #backtracking #bitmask
🟡2305.fair-distribution-of-cookies
🏷️ Tags
#bit_manipulation #array #dynamic_programming #backtracking #bitmask
Telegraph
fair-distribution-of-cookies
You 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 the number of children to distribute all the bags of cookies to. All the cookies in the same bag must go to…
leetcode.com 2023-07-16
🔴1125.smallest-sufficient-team
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask
🔴1125.smallest-sufficient-team
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask
Telegraph
smallest-sufficient-team
In a project, you have a list of required skills req_skills, and a list of people. The ith person people[i] contains a list of skills that the person has. Consider a sufficient team: a set of people such that for every required skill in req_skills, there…
leetcode.com 2023-09-17
🔴847.shortest-path-visiting-all-nodes
🏷️ Tags
#bit_manipulation #breadth_first_search #graph #dynamic_programming #bitmask
🔴847.shortest-path-visiting-all-nodes
🏷️ Tags
#bit_manipulation #breadth_first_search #graph #dynamic_programming #bitmask
Telegraph
shortest-path-visiting-all-nodes
You 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 connected with node i by an edge. Return the length of the shortest path that visits every node. You may start…
leetcode.cn 2023-12-26
🔴1349.maximum-students-taking-exam
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask #matrix
🔴1349.maximum-students-taking-exam
🏷️ Tags
#bit_manipulation #array #dynamic_programming #bitmask #matrix
Telegraph
maximum-students-taking-exam
给你一个 m * n 的矩阵 seats 表示教室中的座位分布。如果座位是坏的(不可用),就用 '#' 表示;否则,用 '.' 表示。 学生可以看到左侧、右侧、左上、右上这四个方向上紧邻他的学生的答卷,但是看不到直接坐在他前面或者后面的学生的答卷。请你计算并返回该考场可以容纳的同时参加考试且无法作弊的 最大 学生人数。 学生必须坐在状况良好的座位上。 示例 1: 输入:seats = [["#",".","#","#",".","#"], [".","#","#","#","#","."], …
leetcode.cn 2025-10-12
🔴3539.find-sum-of-array-product-of-magical-sequences
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #bitmask #combinatorics
🔴3539.find-sum-of-array-product-of-magical-sequences
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #bitmask #combinatorics
Telegraph
find-sum-of-array-product-of-magical-sequences
给你两个整数 M 和 K,和一个整数数组 nums。
leetcode.com 2025-10-12
🔴3539.find-sum-of-array-product-of-magical-sequences
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #bitmask #combinatorics
🔴3539.find-sum-of-array-product-of-magical-sequences
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #bitmask #combinatorics
Telegraph
find-sum-of-array-product-of-magical-sequences
You are given two integers, m and k, and an integer array nums.
leetcode.cn 2025-10-17
🔴3003.maximize-the-number-of-partitions-after-operations
🏷️ Tags
#bit_manipulation #string #dynamic_programming #bitmask
🔴3003.maximize-the-number-of-partitions-after-operations
🏷️ Tags
#bit_manipulation #string #dynamic_programming #bitmask
Telegraph
maximize-the-number-of-partitions-after-operations
给你一个下标从 0 开始的字符串 s 和一个整数 k。 你需要执行以下分割操作,直到字符串 s 变为 空: