• + 6 comments

    Show, my solution is very like with yours, nice to see the similarities, see it:

        static int[] getRecord(int[] s){
            int[] result = new int[2];
            int countMax=0, countMin=0 ,max = s[0], min = s[0];
            for(int i=1; i< s.length; i++){
               if(s[i] > max){ max = s[i];  countMax++; }
               if(s[i] < min){ min = s[i];  countMin++; }
            }
            result[0] = countMax; result[1] = countMin;
            return result;
        }