code: https://ide.codingblocks.com/s/210879
last two elements are not coming sorted?
issue: problem comes when last two if conditions run even when array is already sorted…
for eg. curr status is 0000011222, and m=6,h=6… now when second if runs-> m=7 h=6 —> now even when array is sorted, third if condition will run and makes it unsorted.
solution: updated code: https://ide.codingblocks.com/s/211959
please rate and resolve if satisfies
Thanks a lot… i got my mistake