prob;- https://practice.geeksforgeeks.org/problems/minimum-element-in-a-sorted-and-rotated-array/0
solution:- https://ide.codingblocks.com/s/398680
This test case is working on ide but on gfg it’s showing incorrect output.
prob;- https://practice.geeksforgeeks.org/problems/minimum-element-in-a-sorted-and-rotated-array/0
solution:- https://ide.codingblocks.com/s/398680
This test case is working on ide but on gfg it’s showing incorrect output.
Hello @prashantgupta9876 could you please explain your logic here:
so that we can discuss actually:
please respond.
yes sir, please check I added comments in code,
I am getting the correct output in ide but it is saying the wrong output for the same case in gfg.
@prashantgupta9876 this things happen with me also sometimes and later i find that this happens because your code is not optimised i.e it is taking more time then exoected time written there.
Thanks, brother for your hint.
its required TC is log(n). and for worst-case it was taking n;
I added this.
if(arr[0]<arr[high]){
return arr[0];
}
and it worked.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.