Getting wrong answer


please help

hi @kartik-malik There are 2 things wrong in your merge function, I have corrected them and added comments as well, please have a look. https://ide.codingblocks.com/s/281790
Remember s will not always be 0, so be careful.
Dont forget to mark the doubt as resolved!

but the video has done the same thing i did please check the video at time stamp 18:17 and 14:35

@kartik-malik maybe there was some mistake there…this is the correct code.

but the video output is right

@kartik-malik i have corrected the code according to your code, not the video code. Do you have any doubts regarding this code?

hi @kartik-malik the wrong answer in your code was because you did not use the condition i<=e while copying the array from temp. (in line 32 of your original code)
image
change this line here and correct output will come

1 Like