The link to question is -
https://online.codingblocks.com/app/player/96041/content/73549/4917/code-challenge
The link to code is –
I am not able to remove the error. Please tell what to do
The link to question is -
https://online.codingblocks.com/app/player/96041/content/73549/4917/code-challenge
The link to code is –
I am not able to remove the error. Please tell what to do
Hey @abhaygarg2001,
This code is the problematic part in your code:
for x in range(len(a)):
a[x]=b[p]
p+=1
After merging the two subarrays (start:mid) and (mid+1:high) int the array b, you are iterating on the whole array (range(a)) and trying to fill it instead of just the needed part which is (start:high).
Hope this resolved your issue.
Look at this snippet and you’ll understand the correct approach:
p = 0
for x in range(s, e+1):
a[x]=b[p]
p+=1
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.