Hi Charlie!

Usually, the only reason a test set is skipped is that a previous test set 
failed. Did you get a test set failed message on one of the test sets? Check 
out the Submitting section in the FAQ for a little more clarity: 
https://codingcompetitions.withgoogle.com/codejam/faq

Best,
Matt

> On Apr 16, 2020, at 12:23 PM, Charlie Selden <rainmaker...@gmail.com> wrote:
> 
> 
> I get the correct output when using the test input, which means it works on a 
> small level at least, so I was thinking the former, however that problem 
> already has the answer posted and I followed it so I'm not so sure.
> Any help would be much appreciated! Thanks.
> 
> import java.util.Arrays;
> import java.util.Scanner;
> import java.io.*;
> 
> 
> class Solution {
> 
>     public static void main(String args[]) {
>         Scanner in = new Scanner(new BufferedReader(new 
> InputStreamReader(System.in)));
>             
>             int totalTestCases = in.nextInt();
>             for (int i = 0; i < totalTestCases; i++) {
>                 int budget = 0;
>                 int hsCount = 0;
>                 int[] houseNums;
>                 hsCount += in.nextInt();
>                 budget += in.nextInt();
>                 houseNums = new int[hsCount];
>                 for (int j = 0; j < hsCount; j++) {
>                     houseNums[j] = in.nextInt();
>                 }
>                 System.out.println("Case #" + (i+1) + ": " + 
> getNumOfHouses(budget,houseNums));
>             }
>             in.close();
>     }
>     
>     public static int getNumOfHouses(int budget, int[] houseVals) {
>         
>         countSort(houseVals,1000);
>         
>         int remaining = budget;
>         int afford = 0;
>         
>         for (int house : houseVals) {
>             if (remaining - house >= 0) {
>                 remaining -= house;
>                 afford++;
>             }
>             else {
>                 return afford;
>             }
>         }
>         
>         return 0;
>     }
>     
>     public static void countSort(int array[], int k) {
>         int[] output = new int[array.length];
>         int[] freq = new int[k];
>         for (int i : array) {
>             freq[i]++;
>         }
>         int total = 0;
>         for (int i = 0; i < k; i++) {
>             int oldCount = freq[i];
>             freq[i] = total;
>             total += oldCount;
>         }
>         for (int i : array) {
>             output[freq[i]] = i;
>             freq[i]++;
>         }
>         for (int i = 0; i < array.length; i++) {
>             array[i] = output[i];
>         }
>     }
> }
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/google-code/316df9f0-4bbc-4e68-8d7b-35910e3b9abd%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/51A4BA27-E549-4B66-92E0-3512F10DAA57%40gmail.com.

Reply via email to