Skip to content

Commit 5fc041c

Browse files
committed
Smallest Number that is not a Sum of a Subset of List
1 parent 5bd29a8 commit 5fc041c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/eknv/algorithms/arrays/SmallestNumberNotSumOfSubset.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static int calculate(int[] numbers) {
2323
Assert.notNull(numbers, "numbers");
2424

2525
if (numbers.length == 0) {
26-
throw new RuntimeException("The list cannot be empty");
26+
throw new IllegalArgumentException("The list cannot be empty");
2727
}
2828

2929
validateIsSorted(numbers);
@@ -88,7 +88,7 @@ private static void validateIsSorted(int[] numbers) {
8888
for (int i = 0; i < numbers.length; i++) {
8989

9090
if (numbers[i] < prevValue) {
91-
throw new RuntimeException("This array is not sorted");
91+
throw new IllegalArgumentException("This array is not sorted");
9292
} else {
9393
prevValue = numbers[i];
9494
}

0 commit comments

Comments
 (0)