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?

Learn from Facebook, Google, Uber senior engineers interviewed 100+ candidates.aonecode.com

Most recent interview questions and system design topics gathered from aonecode alumnus.

One-to-one online classes. Get feedbacks from real interviewers.

Already a coding expert? - Advance straight to hard interview topics of your interest.

New to the ground? - Develop basic coding skills with your own designated mentor.

Days before
interview? - Focus on most important problems in target company question bank.