#139 Group with the Most First Places

Companies:
Sberbank
Themes:
JavaStringsPractice

A string contains an id, group name, country, and competition placements. Implement a method that returns the name of the group with the largest number of first-place finishes.

Java
public class Main {

    public static void main(String[] args) {
        String data = "1;Group1;Canada;1;2;3;4;5;" + "\n" +
                      "2;Group2;USA;3;4;5;2;4;6;" + "\n" +
                      "3;Group3;Russia;3;1;5;3;4;5;" + "\n" +
                      "4;Group4;Germany;3;4;1;5;6;" + "\n" +
                      "5;Group5;Japan;3;4;5;3;4;6;" + "\n" +
                      "6;Group6;China;3;4;5;2;3;5;6;";

        String result = findGroupWithMostFirstPlaces(data);
        System.out.println(result);
    }

    public static String findGroupWithMostFirstPlaces(String data) {
        // your code
    }
}

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in