• + 0 comments

    It would never be less than zero since you are always reducing it by the smallest number left in the list.

    You could simplify the population of the list by combining the 2 lines into al.add(sc.nextInt());