Given array of positive items = {1, 2, 3, 4, 4} the simplest brute force solution could be as per below. However, this solution has Time complexity O(n^2)
Do you think there is better solution? Let's find out.
public class Test {
public static int find(int[] items) {
int length = items.length;
for (int i = 0; i < length; i++) {