Why not passing testcase evenif in video same code run

#include
using namespace std;
void mergee(int *a,int s,int e)
{

int i=s;
int mid=(s+e)/2;
int temp[100],k=s,j=mid+1;
while(i<=mid && j<=e)
{
if(a[i]<=a[j])
temp[k++]=a[i++];
else
temp[k++]=a[j++];
}
while(i<=mid)
{
    temp[k++]=a[i++];
}
while(j<=e)
{
    temp[k++]=a[j++];
}
for(int i=0;i<=e;i++)
    a[i]=temp[i];

}
void merge_sort(int *a,int s,int e)
{
int mid=(s+e)/2;
if(s>=e)
return;
merge_sort(a,s,mid);
merge_sort(a,mid+1,e);
mergee(a,s,e);
}
int main()
{
int n;
int arr[100];

cout << "Hello world!" << endl;
cin>>n;
for(int i=0;i<n;i++)
    cin>>arr[i];
merge_sort(arr,0,n-1);
for(int i=0;i<n;i++)
    cout<<arr[i]<<" ";
return 0;

}

@Mihir163
hello Mihir,
image

a)value of n can be upto 2*10^5 so increase ur array size
b) remove cout<<“Hello World” u should only print those statements that are asked to print in output .

#include using namespace std; void mergee(int *a,int s,int e) { int i=s; int mid=(s+e)/2; int temp[100000],k=s,j=mid+1; while(i<=mid && j<=e) { if(a[i]<=a[j]) temp[k++]=a[i++]; else temp[k++]=a[j++]; } while(i<=mid) { temp[k++]=a[i++]; } while(j<=e) { temp[k++]=a[j++]; } for(int i=0;i<=e;i++) a[i]=temp[i]; } void merge_sort(int *a,int s,int e) { int mid=(s+e)/2; if(s>=e) return; merge_sort(a,s,mid); merge_sort(a,mid+1,e); mergee(a,s,e); } int main() { int n; int arr[100000]; cin>>n; for(int i=0;i<n;i++) cin>>arr[i]; merge_sort(arr,0,n-1); for(int i=0;i<n;i++) cout<<arr[i]<<" "; return 0; }

@Mihir163
pls save ur code here -> https://ide.codingblocks.com/
and share the link

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.