please remove the syntax errors only
Syntax error comming
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.
your code is showing exception
please tell me why my program is showing TLE on submitting as it is showing correct output here is the code
import java.util.*; public class Main { public static void main(String args[]) { int i,j,x,n,temp; String s=""; Scanner sc=new Scanner(System.in); x=sc.nextInt(); n=sc.nextInt(); if((x>=1)&&(n>=1&&n<=100000)) { String[] sal=new String[n]; int[] a=new int[n]; for(i=0;i<n;i++) { sal[i]=sc.next(); a[i]=sc.nextInt(); } for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(a[i]<a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; s=sal[i]; sal[i]=sal[j]; sal[j]=s; } else if(a[i]==a[j]) { if(sal[i].compareTo(sal[j])>0) { s=sal[i]; sal[i]=sal[j]; sal[j]=s; } } } } for(i=0;i<n;i++) { if(x<a[i]) System.out.println(sal[i]+" "+a[i]); } } } }
@mohdkaifalam041
i see in your submissions that u ve succesfully submitted the code .good work
compare the previous mistakes to the correct code
mark your doubt as resolved if u are satisfied