MEESHO Coding Question – Solved

7 Live
Given three points a(x1, y1), b(x2, y2), and c(x3, y3), determine if they form a non-degenerate triangle. Then, check if two points, p(xp, yp) and q(xq, yq), are inside or on the triangle. Return the corresponding scenario number: 0. The lines do not form a valid non-degenerate triangle. 1. Point p is inside the triangle, but point q is not. 2. Point q is inside the triangle, but point p is not. 3. Both points p and q are inside the triangle. 4. Neither point p nor point q is inside 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 1 = a(x1, y1) : (2, 2) 2 = b(x2, y2) : (7, 2) 3 = c(x3, y3) : (5, 4)

Asked in: MEESHO

Image of the Question

Question Image Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |