๐ŸŽ Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! ๐Ÿš€

๐Ÿš€ Struggling with coding interviews? We've got you covered! ๐Ÿ’ก Practice real questions, sharpen your skills, and land your dream job! ๐ŸŽฏ
Question 81 - 100% Working Solution | Buy Now

Description

6 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