NEED OPTIMAL SOLUTION

Revision en1, by Jack_sparrow_06, 2023-06-12 16:41:25

Today's test I was asked to a question and I wrote brute force solution but it gave me an TLE. I want to know the optimal approach for the question. Given an Array of size N, you will be given an integer Q, which represents the no.of.queries will be given. Each query will contain two integer {L, R} where L and R represent the range of integers in the Array. You need to find the median for each query in the given range {L, R}. CONSTRAINTS: 1 <= N <= 1e5; 1 <= Q <= 1e5; 1 <= L <= R <= N;

Tags need help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Jack_sparrow_06 2023-06-12 16:41:25 540 Initial revision (published)