Output is wrong!
Where is the problem in my code?
Hi @2000bhaveshkumar, the bug in your code is in Line No. 6 and in Line No. 22. Try to identify them.
Hope this helps !
What is bug in code? Try to explain in bit detail!
Hi @proRram, see:
1. In Line 6 : u have initialized L and R with values A[0] and A[N]. Here 2 things are there. Firstly are these values i.e. A[0] and A[N] really existing till line No. 6. Secondly if array ‘‘A’’ is of size N then is accessing its Nth index correct ??? Think
2. In Line 22: u are searching for the maximum block value in right direction of your current position. But how far will this search go. i.e. what should be the last index of array ‘‘A’’ whose value should be checked for maximum, is it really A[N] can it be A[N] if array ‘‘A’’ is of size N ???
Hope this helps
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.