leetcode.cn 2026-04-19
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
Telegraph
maximum-distance-between-a-pair-of-values
给你两个 非递增 的整数数组 nums1 和 nums2 ,数组下标均 从 0 开始 计数。 下标对 (i, j) 中 0 <= i < nums1.length 且 0 <= j < nums2.length 。如果该下标对同时满足 i <= j 且 nums1[i] <= nums2[j] ,则称之为 有效 下标对,该下标对的 距离 为 j - i 。 返回所有 有效 下标对 (i, j) 中的 最大距离 。如果不存在有效下标对,返回 0 。 一个数组 arr ,如果每个…
leetcode.com 2026-04-19
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
🟡1855.maximum-distance-between-a-pair-of-values
🏷️ Tags
#array #two_pointers #binary_search
Telegraph
maximum-distance-between-a-pair-of-values
You are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j), where 0 <= i < nums1.length and 0 <= j < nums2.length, is valid if both i <= j and nums1[i] <= nums2[j]. The distance of the pair is j - i.…
leetcode.cn 2026-05-19
🟢2540.minimum-common-value
🏷️ Tags
#array #hash_table #two_pointers #binary_search
🟢2540.minimum-common-value
🏷️ Tags
#array #hash_table #two_pointers #binary_search
Telegraph
minimum-common-value
给你两个整数数组 nums1 和 nums2 ,它们已经按非降序排序,请你返回两个数组的 最小公共整数 。如果两个数组 nums1 和 nums2 没有公共整数,请你返回 -1 。 如果一个整数在两个数组中都 至少出现一次 ,那么这个整数是数组 nums1 和 nums2 公共 的。 示例 1: 输入:nums1 = [1,2,3], nums2 = [2,4] 输出:2 解释:两个数组的最小公共元素是 2 ,所以我们返回 2 。 示例 2: 输入:nums1 = [1,2,3,6], nums2 =…
leetcode.com 2026-05-19
🟢2540.minimum-common-value
🏷️ Tags
#array #hash_table #two_pointers #binary_search
🟢2540.minimum-common-value
🏷️ Tags
#array #hash_table #two_pointers #binary_search
Telegraph
minimum-common-value
Given two integer arrays nums1 and nums2, sorted in non-decreasing order, return the minimum integer common to both arrays. If there is no common integer amongst nums1 and nums2, return -1. Note that an integer is said to be common to nums1 and nums2 if both…