This question evaluates proficiency in algorithmic problem-solving for pair counting and entity consolidation, focusing on efficient array processing, threshold-based counting, and merging records by shared identifiers, and it falls under the Coding & Algorithms domain.
You are given two integer arrays A and B, and an integer T.
For each element a in A, count how many elements b in B satisfy:
Return an array ans of length len(A) where ans[i] is the count for A[i].
A
,
B
, integer
T
(all non-negative).
ans
.
1 <= len(A), len(B) <= 1e5
0 <= A[i], B[i] <= 1e5
0 <= T <= 1e10
You are given a list of accounts. Each account is a list of strings:
Two accounts belong to the same real user if they share at least one identifier (directly or transitively). Merge all accounts that belong to the same user.
Return the merged accounts as a list where each merged account is:
[name, id1, id2, ...]
1 <= number_of_accounts <= 1e4
<= 1e5