Question for a data scientist position:
Say you are given a list of tuples where the first element is the slope of a line and the second element is the intercept of a line.
Write a function to find which lines, if any, will intersect in the given range.
Is there a better than O(n^2) algo for this question?
Example
Input:
tuple_list = [(2, 3), (-3, 5), (4, 6), (5, 7)]
range = (0, 1)
Output:
intersections = [(2,3), (-3,5)]