Interviews

[Google SDE] Count Trapezoids

user profile image
System made a post.

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?



One-on-One Algorithm and Coding Training

One-on-One System Design Training

One-on-One Mock Interview

Get one-to-one training from Google Facebook engineers


Top-notch Professionals

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.


Customized Private Class

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.


Free Consultation

aonecoding@gmail.com