An interview question. We are given three positive integers p, q, r such that:

p + q + r = 27
and p<q<r.

Find the number of triangles that are possible using p, q, and r.


HINT: Since $\frac{27}3=9$, it’s clear that $r$ must be at least $10$. In order for $p,q$, and $r$ to be the sides of a non-degenerate triangle, it’s necessary and sufficient that $p+q>r$, so $r$ cannot be more than $13$. Thus, $10\le r\le 13$, and it’s not hard to count the possibilities for each value of $r$.

  • $\begingroup$ oooohhh!! just missed. thanks by the way $\endgroup$ – Rahul Sharma Oct 16 '13 at 23:56
  • $\begingroup$ @Rahul: You’re welcome. $\endgroup$ – Brian M. Scott Oct 16 '13 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.