Skip to content

Commit 8bef457

Browse files
authored
Merge pull request kodecocodes#472 from iyumeg/master
remove "countingSort" func throws
2 parents b5d0580 + c014bd9 commit 8bef457

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Counting Sort/CountingSort.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66
// Copyright © 2016 Ali Hafizji. All rights reserved.
77
//
88

9-
enum CountingSortError: Error {
10-
case arrayEmpty
11-
}
12-
13-
func countingSort(_ array: [Int]) throws -> [Int] {
14-
guard array.count > 0 else {
15-
throw CountingSortError.arrayEmpty
16-
}
9+
func countingSort(_ array: [Int])-> [Int] {
10+
guard array.count > 0 else {return []}
1711

1812
// Step 1
1913
// Create an array to store the count of each element

0 commit comments

Comments
 (0)