Hello !
This code work, but I don't know why the task is not validate...
Can anyone help me please ?...
package fr.codegym.task.task08.task0822;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/*
Le plus petit de N nombres
*/
public class Solution {
public static void main(String[] args) throws Exception {
List<Integer> listeEntiers = obtenirListeEntiers();
System.out.println(obtenirMinimum(listeEntiers));
}
public static int obtenirMinimum(List<Integer> tableau) {
// Trouve le minimum ici
int min = Integer.MAX_VALUE;
for (Integer ini : tableau) {
min = ini < min ? ini : min;
}
return min;
}
public static List<Integer> obtenirListeEntiers() throws IOException {
// Crée et initialise une liste ici
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> numbers = new ArrayList<>(20);
while (true) {
String s = br.readLine();
if (s == null || s.isEmpty()) {
break;
}else {
int N = Integer.parseInt(s);
numbers.add(N);
}
}
return numbers;
}
}