I am getting wrong answer with my code, Problem: Murthal Parantha

Please have a look over my code!
Thanks in advance!

@rkrishna
image
you have commented out the correct line…you have to take user input for the array

https://ide.codingblocks.com/s/277876 Even then I am getting wrong answers as verdict

@rkrishna can you explain the logic behind your ub ? I am assuming it is the upperbound value.
according to me the upperbound should be p(p+1)a[n-1] i am assuming here that a is sorted, so a[n-1] will hold the maximum value

no! that is bad upper bound if a one uses smalest a[0] then it is better ub!
by the way I have rectified the issues it was with recursive call of function
thanks

@rkrishna in that case, please mark your doubt as resolved

1 Like

already done!

thanks

1 Like