Do They Belong?

Problem Overview

  • Determine if triangle abc is non-degenerate and whether points p and q lie on or inside it, then return a scenario code 0–4.
  • Input: integer coordinates x1,y1,x2,y2,x3,y3 and p(xp,yp), q(xq,yq), each in [0,2000]; Output: one integer scenario.
  • Context: 2D computational geometry, point-in-triangle membership in a coding interview problem.
  • Source: Goldman interviews; an interview question testing geometry and boundary cases.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: