Category Archives: Geometric

Paper Cut into Minimum Number of Squares

Given a paper of size A x B. Task is to cut the paper into squares of any size. Find the minimum number of squares that can be cut from the paper. Examples: Input : 13 x 29 Output : 9 Explanation : 2 (squares of size 13×13) + 4 (squares of size 3×3) +… Read More »

Count of parallelograms in a plane

Given some points on a plane, which are distinct and no three of them lie on the same line. We need to find number of Parallelograms with the vertices as the given points. Examples: Input : points[] = {(0, 0), (0, 2), (2, 2), (4, 2), (1, 4), (3, 4)} Output : 2 Two Parallelograms… Read More »

Circle and Lattice Points

Given a circle of radius r in 2-D with origin or (0, 0) as center. The task is to find the total lattice points on circumference. Lattice Points are points with coordinates as integers in 2-D space. Example: Input : r = 5. Output : 12 Below are lattice points on a circle with radius… Read More »

n’th Pentagonal Number

Given an integer n, find the nth Pentagonal number. First three pentagonal numbers are 1, 5 and 12 (Please see below diagram). The n’th pentagonal number Pn is the number of distinct dots in a pattern of dots consisting of the outlines of regular pentagons with sides up to n dots, when the pentagons are… Read More »

Classify a triangle

We are given co-ordinates of a triangle. The task is to classify this triangle on basis of sides and angle. Examples: Input : p1 = (3, 0), p2 = (0, 4), p3 = (4, 7) Output : Right Angle triangle and Isosceles Input : p1 = (0, 0), p2 = (1, 1), p3 = (1,… Read More »