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

1 Answer

0 like 0 dislike
  1. image

 

Test cases -

 

  • Input - N=3 Instance=1 array=[5,10,75] Output - 2 (Instance value updated to 2)
  • Input - N=13 Instance=4 array=[10,20,12,1,56,5,67,89,34,7,11,72,50] Output - 2 (After 2nd operation Instance will be 1 and system stops for 10 secs. Next position will be 12 (indexing -1) where Instance becomes 2)
    Constraints - N<=10000, Instances<=100000 and array[i]<=100000
by Expert (44,360 points)