Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
867 views
in Online Assessments by Expert (111,530 points) | 867 views

1 Answer

1 like 0 dislike
Best answer

Time: 30 min
Platform: Hackerrank

 

Statement 1: Given an array arr of size n, you have to apply the following operation(s): Take a subarray of size k. If this subarray is odd, you have to choose the minimum element in it and if the subarray is odd, you have to choose the maximum element (i.e., subarray 0123....k-1 is the first odd subarray and 123...k is the first even subarray and so on). Apply the same operations on this array of selected numbers until a single element is left.
ex: arr = {9,10,19,14,11} and k=3
After first operation, arr = {9,19,11}
Then arr={9}
Constraints: n<=1e5

 

Statement 2: There are n students, each needing arr[i] for a project they are going to make. They are paired into m inclusive-pairs (a student may appear in more than a single pair). You are the VP of a startup and you have to fund these pairs. There are q queries and you have to answer the maximum number of students you can fund with the amount q[j]. If a student has been previously recieved funds as part of another pair, they won't be funded again.

by Expert (111,530 points)