4 ms·
Oh that's easy (joke)... int min(int a, int b) { ArrayList<Integer> numbers = new ArrayList<Integer>(); numbers.add(a); numbers.add(b)
by ape4 11y ago
Oh that's easy (joke)...
int min(int a, int b) {
ArrayList<Integer> numbers = new ArrayList<Integer>();
numbers.add(a);
numbers.add(b);
Collections.sort(numbers);
return numbers.get(0);
}
- arethuza 11y agoCan I suggest that you write your values to SQL and then use SQL MIN - don't want to reinvent the wheel. Alternatively, maybe you want a big data min with Hadoop? How many things were we working with anyway, are they definitely numbers?