Intersection of two lines
Given geometric data for two lines in arg1, determine whether the two lines have a unique intersection point.
For a complete record [x1, y1, x2, y2, x3, y3, x4, y4], the first line passes through points (x1, y1) and (x2, y2), and the second passes through (x3, y3) and (x4, y4). Return 1 if the two lines intersect at exactly one point, and 0 otherwise.
Two distinct infinite lines intersect uniquely when their direction vectors are not parallel. Parallel lines (including coincident directions with no unique crossing point under the problem's decision contract) do not produce a unique intersection.
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
Compute direction vectors for both lines.
Use the 2D cross product of direction vectors: zero means parallel, nonzero means a unique intersection for non-degenerate lines.
Handle degenerate inputs according to the problem contract.
Related Problems
Intersection of two lines
Given geometric data for two lines in `arg1`, determine whether the two lines have a unique intersection point.