在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Given an array of meeting time intervals consisting of start and end times For example, 给定由开始和结束时间 例如, 给出 返回 1 class Solution { 2 func canAttendMeetings(_ intervals:[[Int]]) -> Bool { 3 var intervals = intervals 4 intervals.sort(by: {(arr1:[Int],arr2:[Int]) -> Bool in 5 return arr1.first! < arr2.first!}) 6 for i in 1..<intervals.count 7 { 8 if intervals[i].first! < intervals[i - 1].last! 9 { 10 return false 11 } 12 } 13 return true 14 } 15 }
|
请发表评论