i’ve written the code for the pratha problem but it is not giving desired output.
please correct. following is the link to my code:
NOT GETTING CORRECT OUTPUT
@Mudit809 In ispossible() function, you are initializing the time_taken variable with zero but lets suppose cur_min = 3, and the rank of cook is 5, then according to your code the loop will run one and add one to ‘prathasmade’ which is not the case.
So, better initialize your timetaken = arr[i], also j=1, because you are considering the you have made that prathas and just checking and incrementing prathasmade if possible.
Also the way you initialized ‘end’ is wrong, because there may be case when their are many cooks but no cook with rank =1. So initialize end = ( (p*(p+1))/2 * min_rank_possible_in_that_test_case).
I hope you will be able to solve it now, feel free to reach out to me if any doubt exists.
Otherwise please mark this doubt as resolved after solving it.
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.