You are viewing a single comment's thread. Return to all 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());
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all 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());