# Mathematics

## Count Triangles formed by the elements of array

Problem Statement Given a sorted array of distinct integers, each of these integers can represent a length. The task at hand is to count the number of possible triangles which can be made through these lengths. Of course, if you chose one length to be one side of the triangle, you cannot use that length again in the same triangle. This means, no triangle contains the same length more than once. Important Note: For given sides of lengths a, b and c. A triangle can only be formed if sum of any two sides is greater than the third side. This is called the triangle inequality. The sum of any...

## Polynomial Operations

Introduction This is a famous interview question where it is asked to write program for simple arithmetic polynomial operations. The operation may include adding, subtracting and multiplication of two polynomials (mostly in one variable). For those who want to refresh their knowledge of polynomials, I would include a section below: Understanding Polynomials Polynomials are mathematical expressions of the form a1xnym + a2xn-1ym-1+ . . . + akxn-ky + . . . + anx + an+1. The above polynomial is said to be a polynomial in two variables (x and y). a1xn + a2xn-1 + a3xn-2 + . . . + an-1x + ...