Skip to content

Instantly share code, notes, and snippets.

@AppleCEO
Created January 16, 2020 15:39
Show Gist options
  • Select an option

  • Save AppleCEO/20c043a9dd3982545f55c0726cd3293b to your computer and use it in GitHub Desktop.

Select an option

Save AppleCEO/20c043a9dd3982545f55c0726cd3293b to your computer and use it in GitHub Desktop.
func solution(_ arr1:[[Int]], _ arr2:[[Int]]) -> [[Int]] {
var i = 0, j = 0
return arr1.map { (numbers) -> [Int] in
defer {
i += 1
j = 0
}
return numbers.map { (number) -> Int in
defer {
j += 1
}
return number + arr2[i][j]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment