i am not able to understand the solution of this code please explain each step in detail
Not able to understand code
hi @lakshyaprasadpe20b1629_7d623815a5ca5f1a,
u need to find the maximum of all nos. so you make a bucket to store the maximum no say you initialize it with some very small value say INT_MIN now you keep updating the values to largest value by checking if the new no is greater than current largest.
eg 1 4 3 2 then initial largest will hold INT_MIN (which is the min value of integer)
now comes 1 since its greater than INT_MIN it will replcae and now largest will be 1
now comes 4 since its greater than largest which is 1 it will replcae and now largest will be 4
then comes 3 its not greater than largest as it is 4 so it will not replace it same with 2
finally largest will store 4 which is your ans
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.