If I have two Arrays, and want to find out if an element(Int) in each equal a predetermind value(Int), how would I do that. I am new to Swift and a little lost.
func twoSum(a:[Int], b:[Int], c: Int) -> Bool {
// iterate through arrays to see if an element in each equal c
return false // if no values equal the sum c
}
twoSum(a: [1,3,4,5], b: [1,3,4,5], c: 10)
I don't need to convert the arrays into Sets, But I'm wondering how to effectively iterate through the two arrays. How would I do this without a a bunch of for or if loops?