Birthday Cake Candles

  • + 8 comments

    I tried this

    static int birthdayCakeCandles(int[] a) {
            Arrays.sort(a);  //double pivot QuicKSort
            int count = 0;
            int i = a.length - 1;
            int tallest = a[i];
            while (a[i--] == tallest) {
                count++;
            }
            return count;
        }
    

    It is failing the test case

    100000 followed by 100000 times 9999999 (as height of candles(array values)).