question asked in infosys OA

Infosys · Question · Posted Jul 2024

You are given array of nums of size n and queries. of size m. For each queries you need to perform the following operation: i. Update A[L-1]=A[L-1]-x where L is [i][0] value of query and x is [i][1] value of ach index i. ii. Copy the modified array in B such that A[0]=B[0] and B[i]=min(B[i-1],A[i]) for 1<=i<n.   Your result should be the unique number of elements in B after every operation. res[i] denotes the result after ith operation. Return ...

The full answer & interview discussion are available to premium members.

Log in Create a free account