Stealth Startup | Software Engineer 2 | San Francisco.
Anonymous User
809

Can some one understand this question and explain what is to be done actually?

Write a function:

"""
def solution(A, B):
pass
"""
that given a linearized tensor A consisting of N integers and array B consisting of K integers representing the size of each dimension of the tensor, returns an array of integers where each element of the output array is the mean of the corresponding element in input A, and it's neighbors in each dimension. The result should be rounded appropriately.

Test Case:

Input:
A = [44, 14, 92, 6]
B = [2, 2, 1, 1]

Output:
[17, 7, 16, 12]

Note: If A = [44, 14, 92, 6], and B = [2, 2, 1, 1], then A represents the linearization of a tensor with an inner-most dimension of size 1 and outer dimesion of size 2.

Thanks in advance!!!

Comments (2)