It is still showing runtime error even after changing the class name to
Solution.

On Tue, 2 Apr 2019, 8:55 p.m. Milho Droid <milho.dr...@gmail.com wrote:

> Your class must be named Solution. I did have the same problem...
>
> Em ter, 2 de abr de 2019 12:16 PM, <abhradiptachakrabortytha...@gmail.com>
> escreveu:
>
>> Hello Everyone,
>> I am facing run time errors in the trouble sort program. I don't know
>> why. I have tried to cover all the aspects asked. Kindly help me. My code
>> is written in Java.
>> The link for the problem is:
>> https://codingcompetitions.withgoogle.com/codejam/round/00000000000000cb/00000000000079cb
>>
>> My Code is:
>>
>> import java.io.*;
>> class TroubleSortSolution
>> {
>>     public static void main(String args[])throws IOException
>>     {
>>         InputStreamReader read =new InputStreamReader(System.in);
>>         BufferedReader in =new BufferedReader(read);
>>         int a,b,n,i,j,t=0,c=0,pos=0;
>>         a=Integer.parseInt(in.readLine());
>>         int sol[] =new int[a];
>>         for(b=1;b<=a;b++)
>>         {
>>         n=Integer.parseInt(in.readLine());
>>         int ar[] =new int[n];
>>         for(i=0;i<n;i++)
>>         {
>>             ar[i]=Integer.parseInt(in.readLine());
>>         }
>>         for(i=0;i<n;i++)
>>         {
>>             for(j=0;j<n-i-2;j++)
>>             {
>>                 if(ar[j]>ar[j+2])
>>                 {
>>                     t=ar[j];
>>                     ar[j]=ar[j+2];
>>                     ar[j+2]=t;
>>                 }
>>             }
>>         }
>>         for(i=0;i<n;i++)
>>         {
>>             for(j=0;j<n-i-1;j++)
>>             {
>>             if(ar[j]>ar[j+1])
>>             {
>>                 pos=j;
>>                 c++;
>>             }
>>         }
>>         }
>>         if(c==0)
>>         {
>>             sol[b-1]=0;
>>         }
>>         else
>>         {
>>             sol[b-1]=pos;
>>         }
>>     }
>>     for(b=0;b<a;b++)
>>     {
>>         if(sol[b]==0)
>>         {
>>             System.out.println("Case #:"+(b+1)+" OK");
>>         }
>>         else
>>         {
>>             System.out.println("Case #:"+(b+1)+" "+sol[b]);
>>         }
>>     }
>> }
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/e1219bde-c8ee-40e0-b9f5-d0dcfdf92833%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAHTNgsW8htAi0_YsE1jUE5XsGmuML-noQBYJYnQucsTwZN%3DZ5g%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-code/CAHTNgsW8htAi0_YsE1jUE5XsGmuML-noQBYJYnQucsTwZN%3DZ5g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAJ%3Dvd48wucbYXsym44eEiNTdda4Oi0wrn%2B43AFktUG3rB%2BWB1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to