Q1: Freebie. Totally forgot
Q2: Flatten digits and return the largest most frequent digit
e.g. [123, 24, 12, 30, 89 ] => [6, 6, 3, 3, 8] => return 6
Q3:
A variant of Task Scheduler, Greedy + Heap
Q4:
Given three arrays [a, b, operations], where the a and b arrays are int arrays, and the operations array represents a list of operations to be performed on the a and or the b array. Return the result of all operations in a list.
There are two possible operations:
[0, idx, val]: assign val to b[idx]; b[idx] = val, return nothing
[1, target]: return the number of all possible combinations of [i, j] so that a[i] + b[j] == target
Example:
[[1, 2, 3], [2, 2], [[1, 5], [0, 0, 1], [1, 5]] => [4, 2]
Walkthrough:
First operation returned 4
The second operation modifies array b and returns nothing
The third operation returned 2