Thanks!

On Fri, 8 Jun 2018 at 22:50, aabhas chawla <[email protected]> wrote:

> Hi ,
>
> Please refer to Quick-Start Guide for Java solution.
> Class name should be Solution.
>
> Thanks,
> Aabhas
>
> On Thu, Jun 7, 2018 at 7:23 AM Chinemerem Enumah <
> [email protected]> wrote:
>
>> Hi I'm new. please can someone explain why I'm getting a runtime error.
>> I put both my solutions here for your analysis.
>> Thank you in advance!
>>
>> link to question -
>> https://codejam.withgoogle.com/2018/challenges/0000000000000130/dashboard/00000000000004c0
>>
>> import java.util.*;
>>
>> /**
>>  *
>>  * @author chinemeremenumah
>>  */
>> public class SenatorEvacuation {
>>
>>     static Scanner in = new Scanner(System.in);
>>
>>     private static void evacuate(Map<Character, Integer> parties) {
>>
>>         Collection<Integer> values = parties.values();
>>         Set<Character> keys = parties.keySet();
>>         int max = Collections.max(values);
>>
>>         while(max != 0){
>>             int count = 0;
>>
>>             for (char party : keys){
>>
>>                 if(count == 2){
>>                     break;
>>                 }
>>
>>                 if(parties.get(party) == max){
>>                     parties.replace(party, max-1);
>>                     System.out.print(party);
>>                     count++;
>>                     max = Collections.max(parties.values());
>>                 }
>>             }
>>
>>             System.out.print(" ");
>>         }
>>
>>     }
>>
>>
>>     private static void evacuate1(Map<Character, Integer> parties) {
>>
>>         Collection<Integer> values = parties.values();
>>         int max = Collections.max(values);
>>
>>         int count = 0;
>>         for (char party : parties.keySet()){
>>             if(count == 2){
>>                 System.out.print(" ");
>>                 evacuate(parties);
>>             }
>>             if(parties.get(party) == max){
>>                 parties.replace(party, max-1);
>>                 System.out.print(party);
>>                 count++;
>>                 max = Collections.max(parties.values());
>>             }
>>         }
>>
>>         if(Collections.max(parties.values()) != 0){
>>             System.out.print(" ");
>>             evacuate(parties);
>>         }
>>
>>     }
>>
>>     public static void main(String[] args){
>>
>>         int itrs = in.nextInt();
>>         Map<Character, Integer> parties = new HashMap<>();
>>         char key = 'A';
>>
>>         for(int i=0; i<itrs; i++){
>>             int n = in.nextInt();
>>             for(int j=0; j<n; j++){
>>                 parties.put(key, in.nextInt());
>>                 key++;
>>             }
>>             System.out.print("Case #"+(i+1)+": ");
>>             evacuate(parties);
>>             parties.clear();
>>             key ='A';
>>             System.out.println(" ");
>>         }
>>     }
>>
>> }
>>
>> --
>> 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 post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/9c5f48db-17ff-47a6-a57a-8ce61a0eb512%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Aabhas Chawla
>
> "There is no such thing as MIRACLE. You just don't know the theory behind
> it yet!"
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAFjJqoecJGstsHZZSS5hOjh3330ZXJKNOJX4v_ojpeGJjPSrGQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-code/CAFjJqoecJGstsHZZSS5hOjh3330ZXJKNOJX4v_ojpeGJjPSrGQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
- Chinemerem

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CANZ9FwgrXAoxyuo%2BmPNimr6MBUrjygPevbhiTkdgaGO94_cTkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to