• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 21, 2024 |690 Views

PROBLEM OF THE DAY : 20/06/2024 | Integral Points Inside Triangle

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Geometry but also build up problem-solving skills.

Given three non-collinear points whose co-ordinates are p(p1, p2), q(q1, q2) and r(r1, r2) in the X-Y plane. Return the number of integral / lattice points strictly inside the triangle formed by these points.
Note: - A point in the X-Y plane is said to be an integral / lattice point if both its coordinates are integral.

Examples

Input: p = (0,0), q = (0,5), r = (5,0)
Output: 6

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/integral-points-in-triangle5026/1