|  | 
|  | 
| back to board | Understanding the solution After so many calculation and math I have solved the problem.....Here we can have two worst cases...
 
 Case 1:
 having all the right shoes first.so here needed time is 2*b and we have now all the left shoes remaining...so total time is 2*b+40...
 
 Case 2:
 we may have 39 right shoes so time needed here is (39*2=78)...then we have only one right foot left but we may encounter all the left shoes and here needed time is 40+2*(a-40)....> 40 for the first 40 shoes and 2*(a-40) is for the remaining shoes as they needed to be thrown away...then we have the only one right foot left and it need 1 second...
 so total time = 78+40+2*(a-40)+1 = 119+2*a-80 = 2*a-39
 
 ans=max(Case 1,Case 2)
 
 
 Edited by author 22.02.2020 03:07
Re: Understanding the solution But it's given that both a,b>=40.....so how 39 right shoes can be there?Re: Understanding the solution mistake in case 2: 119+2*a-80 = 2*a+39everything else is correct
 
 Edited by author 11.01.2021 22:56
 | 
 | 
|