Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func isRectangleOverlap(_ rec1: [Int], _ rec2: [Int]) -> Bool {
- let top1 = rec1[0]
- let top2 = rec2[0]
- let left1 = rec1[1]
- let left2 = rec2[1]
- let right1 = rec1[3]
- let right2 = rec2[3]
- let bottom1 = rec1[2]
- let bottom2 = rec2[2]
- if right1 <= left2 || right2 <= left1 || top1 >= bottom2 || top2 >= bottom1 {
- return false
- }
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement