Triangle and Points

Problem Overview

  • Determine a code (1–5) indicating if a triangle can be formed and whether points p and q lie inside it.
  • Input: triangle vertices (x1,y1),(x2,y2),(x3,y3) and points p(xp,yp) and q(xq,yq); Output: a single integer 1–5 per defined rules.
  • Domain: computational geometry and spatial analysis; a common coding interview problem and interview question.
  • Source: asked in Greyorange interviews; constraints are unspecified.

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: