Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func countApplesAndOranges(s: Int, t: Int, a: Int, b: Int, apples: [Int], oranges: [Int]) -> Void {
- let applesOnSamHouse = apples.filter {
- element -> Bool in
- if a + element >= s && a + element <= t {
- return true
- }
- return false
- }
- let orangesOnSamHouse = oranges.filter {
- element -> Bool in
- if b + element >= s && b + element <= t {
- return true
- }
- return false
- }
- print("\(applesOnSamHouse.count)\n\(orangesOnSamHouse.count)")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement