Challenge array -sort game

https://ide.codingblocks.com/s/52228

code not working

Please post link to the question also.
You can go through the discussion at

It might solve out your problem, otherwise share link to the problem also here.

1 Like

import java.util.*;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int n=sc.nextInt();
String s[]=new String[n];
int a[]=new int[n];
for(int i=0;i<n;i++){
s[i]=sc.next();
a[i]=sc.nextInt();
}
for (int counter = 0; counter < a.length - 1; counter++) {

		for (int j = 0; j < a.length - 1 - counter; j++) {

			if (a[j] < a[j + 1]) {
				int temp = a[j];
                String str = s[j];
				a[j] = a[j + 1];
                s[j]   =   s[j + 1];
				a[j + 1] = temp;
                s[j + 1]   = str;
			}
		}
	}
    for(int i=0;i<a.length-1;i++){
       if(a[i]==a[i+1]){
           int val=s[i].compareTo(s[i+1]);
           if(val>0){
               String temp2=s[i];
               s[i]=s[i+1];
               s[i+1]=temp2;
           }
       } 
    }
    for(int i=0;i<a.length;i++){
        if(a[i]>=x){
        System.out.println(s[i]+" "+a[i]);

    }
    }
}

}

My code is running fine on the compiler of my course when i am performoing the challenge but when submitting it is showing wrong ans for all test cases.???

@Arai

Please ask your doubts from the doubt support section in a new topic.

mam my ask doubt session is over of six months but i still have videos because they are available till 10 months.So now how should I ask doubt if I encounter any???

Hi Anurakht

The doubt support is not valid after 6 months.