Meesho | Pair programming | 21st April 2022
Anonymous User
896

It was a pair programming round there were 3 questions, I couldn't solve any of them. Here are first 2 questions:-
Q1: Divide an array in 3 parts (say a1, a2, a3) such that S2 <= S1 + S3 (Si means sum of subarray i). Return count of all such subarrays. Each subarray should have atleast 1 element.

Q2: Given an array minimse the maximum using following ops:-
For any i in [1, n-1]
Choose any x in [1, arr[i]]
Do arr[i-1] += x; arr[i] -= x;
Return the minimum max(arr);

Array length in both cases is <= 10^5

Comments (6)