Company: Agoda
Difficulty: medium
3. Do They Belong? Given three points a(x1, y1), b(x2, y2), and c(x3, y3), check if they form a non-degenerate triangle. Then, verify if two points, p = (xp, yp) and q = (xq, yq), are inside or on the triangle. Return the appropriate scenario number. Scenarios: 0: the lines do not form a valid non-degenerate triangle 1: point p belongs to the triangle but point q does not 2: point q belongs to the triangle but point p does not 3: both points p and q belong to the triangle 4: neither point p nor point q belong to the triangle Note: A triangle is considered non-degenerate if it meets the following conditions, where |ab| denotes the length of the line segment between points a and b: |ab| + |bc| > |ac| |bc| + |ac| > |ab| |ab| + |ac| > |bc| Example