Loading...
Engaged employer
Find the intersection between 2 NSRanges
Anonymous
Did you manage to finish the question. How many questions did he gave you ?
func findIntersection(range1: NSRange, range2: NSRange) -> NSRange { let intersection = NSIntersectionRange(range1, range2) return intersection }
extension NSRange { func my_intersection(with range: NSRange) -> NSRange? { guard range.lowerBound <= self.upperBound || self.lowerBound <= range.upperBound else { return nil } let start = max(self.lowerBound, range.lowerBound) let end = min(self.upperBound, range.upperBound) return NSRange(location: start, length: end - start) } }
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalised job recommendations and updates by starting your searches.
Get actionable career advice tailored to you by joining more bowls.
Check out your Company Bowl for anonymous work chats.