Min Max Riddle

  • + 4 comments

    Hey , Can you please Explain your solution with help of some real life analogy or any intuition how you ended up getting this sloution ??

    I did this by eliminating the no which didn't occur in the result of one window , I guess its O( nlog(n) ) ... For Example :

    You have { 2, 6 ,1, 12 }

    After First Pass we get : { 2 , 6 , 1, 12} , Max = 12; After Second Pass : { 2, 1, 1} , Max = 2;

    Now what I will be doing is only comparing the results obatined in second pass rather than the original array . So Third Pass would be obtained by Taking mins of ( 2,1) & ( 1,1 ) & finding out the max which will be 1 .

    Third Pass : { 1,1 } , Max =1 ; Fourth Pass : {1} , Max = 1;

    Can you please elaborate your approach intuition ??