Untitled
unknown
python
a year ago
576 B
14
Indexable
def solution(a, b, queries):
result = []
def count_combinations(target):
combinations = 0
for num_a in a:
for num_b in b:
if num_a + num_b == target:
combinations += 1
return combinations
for query in queries:
if query[0] == 0:
# if query[i] == 0, add to b
_, i, x = query
b[i] += x
else:
# if query[i] == 1, twoSum
_, x = query
result.append(count_combinations(x))
return resultEditor is loading...
Leave a Comment