Media.net DS Algo Round 1
Anonymous User
801

Question-1:
Given an array 'A' of 'N' non-negative numbers and an integer 'T'
Find segment(i..j) of A such that
abs(A[i] + A[i+1] + ... + A[j] - T) is minimum.

You have to answer this for 'M' different values of T

N = 10^5
M = 10^5

Example:
N=6, M=4
A = [4, 1, 6, 3, 3, 5]
T_arr = [1, 14, 8, 9]

Output: [(1,1), (0,3), (4,5), (2,3)]

Question-2:
Diagonal Tree Traversal

Please help me, how can we solve first question

Comments (3)