Question: You ejashre given an array A of N integers. tejasribantu 22-JAN 2 You are given M queries in the array Queries where Queries[i] contains

You ejashre given an array A of N integers. tejasribantu 22-JAN 2

 You are given M queries in the array Queries where Queries[i] contains two numbers X, and Y. For each Update the value B[]=min(A[I], B[i-1]) 

You ejashre given an array A of N integers. tejasribantu 22-JAN 2 You are given M queries in the array Queries where Queries[i] contains two numbers X, and Y. For each Update the value B[]=min(A[I], B[i-1]) where (0 The values in array A stay non-negative during all queries. ejribantu 22-JAN-202 Format The next line contains an Queries. thejasribantu 1718@ 22-JAN-2023 The first line contains an integer, N, denoting the number of elements in A. M, denoting the number of rows in Each line i of the N describing A[i]. ejashi lines (where 0 i < N) contains an integer Each line i of the M subsequent lines (where 0 si < M) contains 2 parated integers each describing the row Queries[i]. tejasriban18@gm ace 023 Constraints 1 5 4 10 ejabantu1718@gma 72-20234. 2 62 24 52 15 32 423 ejasribantu 1718@gmail.com ejasribantu 17/18@gmail.com 22-JAN-2023 tel teja @gm N=5M 4A [10, 13, 5, 2, 6] Queries [[2, 4], [5, 2], [1, 5], [3, After the first query. the array A becomes [10,9,5,2,6] so B= [10,9,5,2,2], answer=4. After the second query the array A becomes [10,9,5,2,4] so B= [10,9,5,2,2]. = 24 8@gma 2-JAN-2023 answer=4. After the third query the array A becomes [5,9,5,2,4] so B=[5,5,5,2,2]. answer=2. After the fourth query, the array A becomes [5,9,3,2,4] so B=[5,5,3,2,2]. answer= 3. Hence, Leje Res=14, 4, 2, 31. gma 2023

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a Python code to solve the given problem python def numdistinctnum... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!