Company: Coinbase
Difficulty: medium
Array Query Processing You are given two arrays of integers a and b , and an array queries containing the queries you are required to process. Every queries[i] can have one of the following two forms: [0, i, x] : In this case, you need to add x to the current value of b[i] [1, x] : In this case, you need to find the total number of pairs of indices i and j such that a[i] + b[j] = x Perform the given queries in order and return an array containing the results of the queries of the type [1, x] . Input Format array.integer a : An array of integers array.integer b : An array of integers array.array.integer queries : A 2D array where queries[i][0] represents the type of query Constraints 1 ≤ a.length ≤ 10³ 0 ≤ a[i] ≤ 10⁸ 1 ≤ b.length ≤ 5 × 10⁴ 0 ≤ b[i] ≤ 10⁸ 1 ≤ queries.length ≤ 10³ For queries of type [0, i, x]: 0 ≤ i For queries of type [1, x]: 0 ≤ x ≤ 3 × 10⁸ Examples Example 1: Input: a = [1, 2, 3] b = [1, 4] queries = [[1, 5], [0, 0, 2], [1, 5]] Output: [1, 2] Initially: a = [1, 2, 3]