Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
546 B
0
Indexable
Never
public ArrayList<Integer> solve(ArrayList<Integer> A) {
        ArrayList<Integer> output= new ArrayList<Integer>();
        if(A.size()<3) {
            return output;
        } 
        for(int i=0;i<A.size();i++) {
            int count=0;
            for(int j=0;j<A.size();j++) {
                if(A.get(j)<A.get(i)) {
                    count++;    
                }
                if(count>=2) {
                    output.add(A.get(i));
                    break;
                }
            }
        }
        return output;
    }