Problem A — Count qualifying products
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:
a×b≥T
Return an array ans of length len(A) where ans[i] is the count for A[i].
Input/Output
-
Input:
integers arrays
A
,
B
, integer
T
(all non-negative).
-
Output:
integer array
ans
.
Constraints (typical interview scale)
-
1 <= len(A), len(B) <= 1e5
-
0 <= A[i], B[i] <= 1e5
-
0 <= T <= 1e10
Problem B — Merge user accounts by shared identifiers
You are given a list of accounts. Each account is a list of strings:
-
The first string is a
user name
.
-
The remaining strings are
identifiers
(e.g., emails).
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.
Output format
Return the merged accounts as a list where each merged account is:
-
[name, id1, id2, ...]
-
Identifiers must be
unique
and
sorted lexicographically
.
-
You may output merged accounts in any order.
Notes
-
If multiple accounts with different names get connected via identifiers, assume the name for the merged result can be taken from any one of the connected accounts (state your choice).
Constraints (typical interview scale)
-
1 <= number_of_accounts <= 1e4
-
Total number of identifiers across all accounts
<= 1e5