Menu
Question Index
...


Write a program to get the bin with maximum marks after separating them into five bins. The bins should be created using the minimum and maximum marks. In case of rounding error, reduce the range for the highest marks bin. The returned map should contain only one bin.

Input (List) Output (Map)
[12, 16, 19, 31, 39, 42, 46, 49] {12-19=[12, 16, 19]}
[91, 102, 106, 190, 191, 192, 196, 199, 200] {179-200=[190, 191, 192, 196, 199, 200]}
[1, 6, 100, 120, 140, 160, 182, 200, 242, 300, 362, 382, 400, 432, 450] {361-450=[362, 382, 400, 432, 450]}
[20, 42, 62, 82, 99] {84-99=[99]}

class GetBinWithMaximumNumberOfMarks

{    public static void main(String s[])
    {
        List marks = new ArrayList();
        marks.add(1);
        marks.add(10);
        marks.add(25);
        marks.add(36);
        marks.add(38);
        marks.add(49);
        marks.add(62);
        marks.add(69);
        marks.add(82);
        marks.add(96);
        marks.add(99);
        System.out.println("The maximum number of marks are in bin : " + getBinWithMaximumNumberOfMarks(marks));

    }


public static Map<String, List<Integer>> getBinWithMaximumNumberOfMarks(List<Integer> marks) {
//Write code here to find the bin with maximum number of marks
}
}

Doubts

Problems

Topic: Java HashMap Implementation

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App