December 2015
Intermediate to advanced
400 pages
13h 3m
English
Write a generic function called findAll(_:_:) that takes an array of any type T that conforms to the Equatable protocol and a single element (also of type T).
findAll(_:_:) should return an array of integers corresponding to every location where the element was found in the array.
For example, findAll([5,3,7,3,9], 3) should return [1,3] because the item 3 exists at indices 1 and 3 in the array.
Try your function with both integers and strings.
Read now
Unlock full access