Birthday Cake Candles

  • + 5 comments

    Be aware of time complexity. In my testcase 4, n was 10000. If you use a sorting algorithm with n^2, you will get a runtime error.

    The way I structured my code is:

    1. Sort the array from min to max (quickSort)
    2. Parse from the very end of the array and iterate count++.
    3. When your values are no longer identical, stop.