Three of my accounts recently achieved the #1, #2 and #3 leetcode ratings in South Korea. lol 😂
Leetcode contest speed-run global rank 2nd
3134. Find the Median of the Uniqueness Array
You are given an integer array
nums
. The uniqueness array ofnums
is the sorted array that contains the number of distinct elements of all the subarrays ofnums
. In other words, it is a sorted array consisting ofdistinct(nums[i..j])
, for all0 <= i <= j < nums.length
.Here,
distinct(nums[i..j])
denotes the number of distinct elements in the subarray that starts at indexi
and ends at indexj
.Return the median of the uniqueness array of
nums
.Note that the median of an array is defined as the middle element of the array when it is sorted in non-decreasing order. If there are two choices for a median, the smaller of the two values is taken.
You are given two integers
n
andx
. You have to construct an array of positive integersnums
of sizen
where for every0 <= i < n - 1
,nums[i + 1]
is greater thannums[i]
, and the result of the bitwiseAND
operation between all elements ofnums
isx
.Return the minimum possible value of
nums[n - 1]
.
Find the Integer Added to Array II
You are given two integer arrays
nums1
andnums2
.From
nums1
two elements have been removed, and all other elements have been increased (or decreased in the case of negative) by an integer, represented by the variablex
.As a result,
nums1
becomes equal tonums2
. Two arrays are considered equal when they contain the same integers with the same frequencies.Return the minimum possible integer
x
that achieves this equivalence.
3131. Find the Integer Added to Array I
You are given two arrays of equal length,
nums1
andnums2
.Each element in
nums1
has been increased (or decreased in the case of negative) by an integer, represented by the variablex
.As a result,
nums1
becomes equal tonums2
. Two arrays are considered equal when they contain the same integers with the same frequencies.Return the integer
x
.