Hi everyone,
                   I am new to Google Kickstart and this is my first ever 
attempt.
                   My java code gives the correct answer when runs locally, 
but gives WA on the google platform.
                   This is my code
                                        
                                          
import java.util.*;
class Solution
{
   public static void main(String[] args)
    {
     Scanner sc = new Scanner(System.in);
     int t=sc.nextInt();
                int c[]=new int[t];

     for(int i=0;i<t;i++)
     {
         int n = sc.nextInt();
         int b = sc.nextInt();

         int a[]=new int[n];
         for(int j=0;j<n;j++)
           {
            a[j]=sc.nextInt();
           }
          
           Arrays.sort(a);
           
                   
           int s=0;
           if(b<a[0])
           c[i]=0;
           else
           {
               int k=0;
               int u=0;
               while(s<b&&k<n)
               {
                       s=s+a[k];
                       
                   if(s>b)
                   break;
                       k++;
                       u++;
                   
               }

               c[i]=u;
           }
     }
       for(int i=0;i<t;i++)
       {
           int v=i+1;
       System.out.println("Case #"+v+":"+c[i]);
       }
}
    
}


Please anyone help me know where I went wrong.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/559be4f9-d9b8-465e-904a-16870308d594%40googlegroups.com.

Reply via email to