What's wrong with this code? For me it works just fine.

public class Solution {
    private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static int N;

    public static void main(String[] args) throws Exception {
        N = Integer.parseInt(reader.readLine());
        List<Integer> integerList = getIntegerList();
        System.out.println(getMinimum(integerList));
    }

    public static int getMinimum(List<Integer> array) {
        int min = array.get(0);
        for (int number : array)
        if (number < min)
            min = number;
        return min;
    }

    public static List<Integer> getIntegerList() throws IOException {
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < N; ++i)
            list.add(Integer.parseInt(reader.readLine()));
        return list;
    }
}

asked 18 Apr '17, 09:17

noelo's gravatar image

noelo
103
accept rate: 0%


Task of the lesson is ensured for the persons. The pertinent use of the picture and visits of the bestessays discount code have been done for the humans. The method is inflicted for the good and all marvelous outlook for the people.

link

answered 04 Jan, 06:37

cocyz's gravatar image

cocyz
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×20

Asked: 18 Apr '17, 09:17

Seen: 444 times

Last updated: 04 Jan, 06:37