We have some baskets containing apples, and we would like to perform the following procedure in a way that maximizes the number of remaining apples. First, we discard some (or none) of the baskets completely. Then, if the remaining baskets do not all contain the same number of apples, we remove excess apples from the baskets until they do.
You will be given a int[] apples where the ith element of apples is the number of apples in the ith basket. Return the number of apples remaining after the procedure described above is performed.
