Skip to content

Commit 10615df

Browse files
authored
Update LinearSearch.swift
more swift
1 parent 0837113 commit 10615df

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Linear Search/LinearSearch.swift

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ func linearSearch<T: Equatable>(_ array: [T], _ object: T) -> Int? {
44
}
55
return nil
66
}
7+
8+
func linearSearch1<T: Equatable>(_ array: [T], _ object: T) -> Array<T>.Index? {
9+
return array.index { $0 == object }
10+
}

0 commit comments

Comments
 (0)