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-06-28
🟡1514.path-with-maximum-probability
🏷️ Tags
#graph #array #shortest_path #heap_priority_queue
🟡1514.path-with-maximum-probability
🏷️ Tags
#graph #array #shortest_path #heap_priority_queue
Telegraph
path-with-maximum-probability
You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability of success of traversing that edge succProb[i]. Given two nodes start and end…
leetcode.com 2023-06-29
🔴864.shortest-path-to-get-all-keys
🏷️ Tags
#bit_manipulation #breadth_first_search #array #matrix
🔴864.shortest-path-to-get-all-keys
🏷️ Tags
#bit_manipulation #breadth_first_search #array #matrix
Telegraph
shortest-path-to-get-all-keys
You are given an m x n grid grid where:
leetcode.com 2023-06-30
🔴1970.last-day-where-you-can-still-cross
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix
🔴1970.last-day-where-you-can-still-cross
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix
Telegraph
last-day-where-you-can-still-cross
There is a 1-based binary matrix where 0 represents land and 1 represents water. You are given integers row and col representing the number of rows and columns in the matrix, respectively. Initially on day 0, the entire matrix is land. However, each day a…
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-02
🔴1601.maximum-number-of-achievable-transfer-requests
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
🔴1601.maximum-number-of-achievable-transfer-requests
🏷️ Tags
#bit_manipulation #array #backtracking #enumeration
Telegraph
maximum-number-of-achievable-transfer-requests
We have n buildings numbered from 0 to n - 1. Each building has a number of employees. It's transfer season, and some employees want to change the building they reside in. You are given an array requests where requests[i] = [fromi, toi] represents an employee's…
leetcode.cn 2023-07-04
🟡2679.sum-in-a-matrix
🏷️ Tags
#array #matrix #sorting #simulation #heap_priority_queue
🟡2679.sum-in-a-matrix
🏷️ Tags
#array #matrix #sorting #simulation #heap_priority_queue
Telegraph
sum-in-a-matrix
给你一个下标从 0 开始的二维整数数组 nums 。一开始你的分数为 0 。你需要执行以下操作直到矩阵变为空:
leetcode.com 2023-07-05
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
🟡1493.longest-subarray-of-1s-after-deleting-one-element
🏷️ Tags
#array #dynamic_programming #sliding_window
Telegraph
longest-subarray-of-1s-after-deleting-one-element
Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1's in the resulting array. Return 0 if there is no such subarray. Example 1: Input: nums = [1,1,0,1] Output: 3 Explanation:…
leetcode.cn 2023-07-06
🟡2178.maximum-split-of-positive-even-integers
🏷️ Tags
#greedy #math #backtracking
🟡2178.maximum-split-of-positive-even-integers
🏷️ Tags
#greedy #math #backtracking
Telegraph
maximum-split-of-positive-even-integers
给你一个整数 finalSum 。请你将它拆分成若干个 互不相同 的正偶数之和,且拆分出来的正偶数数目 最多 。
leetcode.com 2023-07-06
🟡209.minimum-size-subarray-sum
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
🟡209.minimum-size-subarray-sum
🏷️ Tags
#array #binary_search #prefix_sum #sliding_window
Telegraph
minimum-size-subarray-sum
Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no such subarray, return 0 instead. Example 1: Input: target = 7, nums = [2,3,1,2,4…
leetcode.com 2023-07-07
🟡2024.maximize-the-confusion-of-an-exam
🏷️ Tags
#string #binary_search #prefix_sum #sliding_window
🟡2024.maximize-the-confusion-of-an-exam
🏷️ Tags
#string #binary_search #prefix_sum #sliding_window
Telegraph
maximize-the-confusion-of-an-exam
A teacher is writing a test with n true/false questions, with 'T' denoting true and 'F' denoting false. He wants to confuse the students by maximizing the number of consecutive questions with the same answer (multiple trues or multiple falses in a row). You…