leetcode.cn 2026-11-08
🟡1267.count-servers-that-communicate
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #counting #matrix
🟡1267.count-servers-that-communicate
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #counting #matrix
Telegraph
count-servers-that-communicate
这里有一幅服务器分布图,服务器的位置标识在 m * n 的整数矩阵网格 grid 中,1 表示单元格上有服务器,0 表示没有。 如果两台服务器位于同一行或者同一列,我们就认为它们之间可以进行通信。 请你统计并返回能够与至少一台其他服务器进行通信的服务器的数量。 示例 1: 输入:grid = [[1,0],[0,1]] 输出:0 解释:没有一台服务器能与其他服务器进行通信。 示例 2: 输入:grid = [[1,0],[1,1]] 输出:3 解释:所有这些服务器都至少可以与一台别的服务器进行通信。…
leetcode.com 2026-11-08
🟡1267.count-servers-that-communicate
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #counting #matrix
🟡1267.count-servers-that-communicate
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #counting #matrix
Telegraph
count-servers-that-communicate
You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.Return…
leetcode.cn 2026-11-09
🔴1606.find-servers-that-handled-most-number-of-requests
🏷️ Tags
#array #ordered_set #simulation #heap_priority_queue
🔴1606.find-servers-that-handled-most-number-of-requests
🏷️ Tags
#array #ordered_set #simulation #heap_priority_queue
Telegraph
find-servers-that-handled-most-number-of-requests
你有 k 个服务器,编号为 0 到 k-1 ,它们可以同时处理多个请求组。每个服务器有无穷的计算能力但是 不能同时处理超过一个请求 。请求分配到服务器的规则如下:
leetcode.com 2026-11-09
🔴1606.find-servers-that-handled-most-number-of-requests
🏷️ Tags
#array #ordered_set #simulation #heap_priority_queue
🔴1606.find-servers-that-handled-most-number-of-requests
🏷️ Tags
#array #ordered_set #simulation #heap_priority_queue
Telegraph
find-servers-that-handled-most-number-of-requests
You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite computational capacity but cannot handle more than one request at a time. The requests are assigned to servers according to…
leetcode.cn 2026-11-12
🟢3105.longest-strictly-increasing-or-strictly-decreasing-subarray
🏷️ Tags
#array
🟢3105.longest-strictly-increasing-or-strictly-decreasing-subarray
🏷️ Tags
#array
Telegraph
longest-strictly-increasing-or-strictly-decreasing-subarray
给你一个整数数组 nums 。 返回数组 nums 中 严格递增 或 严格递减 的最长非空子数组的长度。 示例 1: 输入:nums = [1,4,3,3,2] 输出:2 解释: nums 中严格递增的子数组有[1]、[2]、[3]、[3]、[4] 以及 [1,4] 。 nums 中严格递减的子数组有[1]、[2]、[3]、[3]、[4]、[3,2] 以及 [4,3] 。 因此,返回 2 。 示例 2: 输入:nums = [3,3,3,3] 输出:1 解释: nums 中严格递增的子数组有 [3]、[3]、[3]…
leetcode.com 2026-11-12
🟢3105.longest-strictly-increasing-or-strictly-decreasing-subarray
🏷️ Tags
#array
🟢3105.longest-strictly-increasing-or-strictly-decreasing-subarray
🏷️ Tags
#array
Telegraph
longest-strictly-increasing-or-strictly-decreasing-subarray
You are given an array of integers nums. Return the length of the longest subarray of nums which is either strictly increasing or strictly decreasing. Example 1: Input: nums = [1,4,3,3,2] Output: 2 Explanation: The strictly increasing subarrays of nums…
leetcode.cn 2026-11-13
🔴3420.count-non-decreasing-subarrays-after-k-operations
🏷️ Tags
#stack #segment_tree #queue #array #sliding_window #monotonic_queue #monotonic_stack
🔴3420.count-non-decreasing-subarrays-after-k-operations
🏷️ Tags
#stack #segment_tree #queue #array #sliding_window #monotonic_queue #monotonic_stack
Telegraph
count-non-decreasing-subarrays-after-k-operations
给你一个长度为 n 的数组 nums 和一个整数 k 。 对于 nums 中的每一个子数组,你可以对它进行 至多 k 次操作。每次操作中,你可以将子数组中的任意一个元素增加 1 。 注意 ,每个子数组都是独立的,也就是说你对一个子数组的修改不会保留到另一个子数组中。 请你返回最多 k 次操作以内,有多少个子数组可以变成 非递减 的。 如果一个数组中的每一个元素都大于等于前一个元素(如果前一个元素存在),那么我们称这个数组是 非递减 的。 示例 1: 输入:nums = [6,3,1,2,4,4], k…
leetcode.com 2026-11-13
🔴3420.count-non-decreasing-subarrays-after-k-operations
🏷️ Tags
#stack #segment_tree #queue #array #sliding_window #monotonic_queue #monotonic_stack
🔴3420.count-non-decreasing-subarrays-after-k-operations
🏷️ Tags
#stack #segment_tree #queue #array #sliding_window #monotonic_queue #monotonic_stack
Telegraph
count-non-decreasing-subarrays-after-k-operations
You are given an array nums of n integers and an integer k. For each subarray of nums, you can apply up to k operations on it. In each operation, you increment any element of the subarray by 1. Note that each subarray is considered independently, meaning…
leetcode.cn 2026-11-15
🟡1524.number-of-sub-arrays-with-odd-sum
🏷️ Tags
#array #math #dynamic_programming #prefix_sum
🟡1524.number-of-sub-arrays-with-odd-sum
🏷️ Tags
#array #math #dynamic_programming #prefix_sum
Telegraph
number-of-sub-arrays-with-odd-sum
给你一个整数数组 arr 。请你返回和为 奇数 的子数组数目。 由于答案可能会很大,请你将结果对 10^9 + 7 取余后返回。 示例 1: 输入:arr = [1,3,5] 输出:4 解释:所有的子数组为 [[1],[1,3],[1,3,5],[3],[3,5],[5]] 。 所有子数组的和为 [1,4,9,3,8,5]. 奇数和包括 [1,9,3,5] ,所以答案为 4 。 示例 2 : 输入:arr = [2,4,6] 输出:0 解释:所有子数组为 [[2],[2,4],[2,4,6],[4]…
leetcode.com 2026-11-15
🟡1524.number-of-sub-arrays-with-odd-sum
🏷️ Tags
#array #math #dynamic_programming #prefix_sum
🟡1524.number-of-sub-arrays-with-odd-sum
🏷️ Tags
#array #math #dynamic_programming #prefix_sum
Telegraph
number-of-sub-arrays-with-odd-sum
Given an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 109 + 7. Example 1: Input: arr = [1,3,5] Output: 4 Explanation: All subarrays are [[1],[1,3],[1,3,5],[3],[3,5],[5]] All…
leetcode.cn 2026-11-17
🔴2911.minimum-changes-to-make-k-semi-palindromes
🏷️ Tags
#two_pointers #string #dynamic_programming
🔴2911.minimum-changes-to-make-k-semi-palindromes
🏷️ Tags
#two_pointers #string #dynamic_programming
Telegraph
minimum-changes-to-make-k-semi-palindromes
给你一个字符串 s 和一个整数 k,请将 s 划分为 k 个 非空子串 ,使得将每个子串变为 半回文串 所需的字符修改次数之和最小。 返回所需的 最少 字符修改次数。 半回文串 是一类特殊的字符串:它可以按照某种重复模式拆分后,使每一组都成为 回文串 。判断一个字符串是否为半回文串的方法如下:
leetcode.com 2026-11-17
🔴2911.minimum-changes-to-make-k-semi-palindromes
🏷️ Tags
#two_pointers #string #dynamic_programming
🔴2911.minimum-changes-to-make-k-semi-palindromes
🏷️ Tags
#two_pointers #string #dynamic_programming
Telegraph
minimum-changes-to-make-k-semi-palindromes
Given a string s and an integer k, partition s into k substrings such that the letter changes needed to make each substring a semi-palindrome are minimized. Return the minimum number of letter changes required. A semi-palindrome is a special type of string…