CS-OA cs-vo Faang



You are given a rectangular matrix and an integer sizeConsider all the size x size contiguous squaresubmatrices of matrix . Your task is the following!

Calculate the sum of all numbers within each size xsize submatrix.
Determine the maximum of all these sums - maxsumWithin all size x size submatrices having the sumof maxsum , find all distinct numbers that appear in atleast one of them. Return the sum of these distinctnumbers, considering every unique number from thelist exactly once.

You are given two arrays of integers a and b ,and anarray queries containing the queries you are required toprocess. Every queries[i] can have one of the followingtwo forms:
[o, i, x] .ln this case, you need to add x to thecurrent value of b[i] .
[1,x] .In this case, you need to find the totalnumber of pairs ofindices i and j such that a[il

  • b[j] =x
    Perform the given queries in order and return an arraycontaining the results of the queries of the type [1,x]


Leave a Reply

Your email address will not be published. Required fields are marked *