What is wrong in the code. Strength is not correct.
Magical Park Question in the video
Check now=>
Hey! You have just updated the code same as in the video prateek bhaiya has told but I wanted to know the error I have done, implemented by me that was not producing correct strength. Now how could I see my original one that I have written?
Your original code
one i have updated
The size of the a array should be 100 rows and columns your was 50
Also you haven’t seen the input format of the question as in it was mentioned to input row, col, initial strength and final strength and then input array
but you were taking input array in between col and initial strength
If any other doubts left, see this
How would taking input of minStrength and initialS after taking the input of char array would affect the code or it’s implementation.
Sir the only difference is that I am putting the condition of subtracting 1 for each step taken after entering the j loop but the video solution is putting after the condition check and that is creating difference in output. How is it please explain. What difference is it creating in giving answers then?
Cause of input format what it will do is that it will take minimum and initial strength as a[0][0] and a[0][1] and minimum & initial strength will have value of a[n-1][m-2] & a[n-1][m-1] thus causing TLE, whereas make a size of 100 rows and columns as given in constraints.
It’s cause of data flow, whereas in your if condition you are checking if j!= col-1
Instead you should have done that your j is less then col-1 which is also causing different output.
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.