Find intersection of two line segments | Applied Interview Question