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

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |