Google | Phone Screen | Count Trapezoids

GEOMETRY PROBLEM

Given definition of Trapezoid/Trapezium: https://www.mathsisfun.com/geometry/trapezoid.html
A trapezoid is a 4-sided flat shape with straight sides that has a pair of opposite sides parallel.

Question 1:
Given an integer N which represents number of edges, where bases are always 2.
Find how many trapezoid you can create with the integer N?

Hint:
Use algorithmic approach to find solution, a count of possible trapezoid, don't have to use any mathematical formula (if you dont know)

E-g N =2 --> count = 1
E-g N =3 --> count = 3
E-g N =4 --> count = 6

Question 2:
Imagine now the N=4 and 2 of the edges are on the same line, how many trapezoid you can create with the integer N?

Has anyone experienced such type of questions in the interview?
I would like to know how would you approach this problem?

Comments (2)