Seemed simple at first and then I started second-guessing myself on edge cases.
Start by clarifying the representation of the lines (e.g., two points per line, slope-intercept form, or standard form) and then compare their slopes or direction vectors. Discuss the mathematical condition for parallelism, including edge cases like vertical lines and floating-point precision.
Pro tip: Mention using the cross product of direction vectors to avoid division-by-zero issues and to handle floating-point comparisons with an epsilon tolerance. This shows awareness of numerical stability and edge cases.
Ask how the lines are given: as two points each, as equations, or as vectors. This determines the method to compute slopes or direction vectors.
For each line, derive a direction vector (e.g., from two points) or compute the slope. Avoid division by zero by using vectors or handling vertical lines separately.
Two lines are parallel if their direction vectors are scalar multiples (cross product zero) or if their slopes are equal. Use an epsilon for floating-point comparisons.
Consider vertical lines (undefined slope), coincident lines (which are technically parallel but may need distinction), and numerical precision issues.
Compare approaches: slope comparison is simple but fails for vertical lines; cross product is robust but requires vector math. Mention time and space complexity (O(1)).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.