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…
leetcode.cn 2026-05-20
🟡2657.find-the-prefix-common-array-of-two-arrays
🏷️ Tags
#bit_manipulation #array #hash_table
🟡2657.find-the-prefix-common-array-of-two-arrays
🏷️ Tags
#bit_manipulation #array #hash_table
Telegraph
find-the-prefix-common-array-of-two-arrays
给你两个下标从 0 开始长度为 n 的整数排列 A 和 B 。 A 和 B 的 前缀公共数组 定义为数组 C ,其中 C[i] 是数组 A 和 B 到下标为 i 之前公共元素的数目。 请你返回 A 和 B 的 前缀公共数组 。 如果一个长度为 n 的数组包含 1 到 n 的元素恰好一次,我们称这个数组是一个长度为 n 的 排列 。 示例 1: 输入:A = [1,3,2,4], B = [3,1,2,4] 输出:[0,2,3,4] 解释:i = 0:没有公共元素,所以 C[0] = 0 。 i = 1:1…
leetcode.com 2026-05-20
🟡2657.find-the-prefix-common-array-of-two-arrays
🏷️ Tags
#bit_manipulation #array #hash_table
🟡2657.find-the-prefix-common-array-of-two-arrays
🏷️ Tags
#bit_manipulation #array #hash_table
Telegraph
find-the-prefix-common-array-of-two-arrays
You are given two 0-indexed integer permutations A and B of length n. A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present at or before the index i in both A and B. Return the prefix common array…
leetcode.cn 2026-05-21
🟡3043.find-the-length-of-the-longest-common-prefix
🏷️ Tags
#trie #array #hash_table #string
🟡3043.find-the-length-of-the-longest-common-prefix
🏷️ Tags
#trie #array #hash_table #string
Telegraph
find-the-length-of-the-longest-common-prefix
给你两个 正整数 数组 arr1 和 arr2 。 正整数的 前缀 是其 最左边 的一位或多位数字组成的整数。例如,123 是整数 12345 的前缀,而 234 不是 。 设若整数 c 是整数 a 和 b 的 公共前缀 ,那么 c 需要同时是 a 和 b 的前缀。例如,5655359 和 56554 有公共前缀 565 和 5655,而 1223 和 43456 没有 公共前缀。 你需要找出属于 arr1 的整数 x 和属于 arr2 的整数 y 组成的所有数对 (x, y) 之中最长的公共前缀的长度。…
leetcode.com 2026-05-21
🟡3043.find-the-length-of-the-longest-common-prefix
🏷️ Tags
#trie #array #hash_table #string
🟡3043.find-the-length-of-the-longest-common-prefix
🏷️ Tags
#trie #array #hash_table #string
Telegraph
find-the-length-of-the-longest-common-prefix
You are given two arrays with positive integers arr1 and arr2. A prefix of a positive integer is an integer formed by one or more of its digits, starting from its leftmost digit. For example, 123 is a prefix of the integer 12345, while 234 is not. A common…