from 2 only on test case pass but the output is correct
what is the problem with this help ASAP
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int [] A = new int[N];
for(int i=0; i<A.length; i++)
{
A[i] = sc.nextInt();
}
quick(A,0,A.length-1);
for(int val : A)
{
System.out.print(val+" ");
}
}
public static void quick(int[] arr, int lo, int hi)
{
//base case
if(lo>=hi)
{
return;
}
int mid = (lo+hi)/2;
int pivot = arr[mid];
int left = lo;
int right = hi;
while(left<=right)
{
while(arr[left]<pivot)
{
left++;
}
while(arr[right]>pivot)
{
right--;
}
if(left<=right)
{
int temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
quick(arr,lo,right);
quick(arr,left,hi);
}
}
}