MEESHO Coding Question – Solved

10 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

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |