one of my test case does no pass
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for(int i =0 ; i <arr.length ; i++)
{
arr[i] = sc.nextInt();
}
quick(arr,0,arr.length-1);
for(int i :arr)
{
System.out.print(i +" ");
}
}
public static void quick(int[] arr , int lo, int hi)
{
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);
}
}
}