I'm trying to solve the following problem. I'm given few sticks of length [42, 40, 32, 30, 25, 18, 15] in this case. I'm able to construct three valid combinations of triangle. Now I need to calculate the distance between the lines (ie' the width occupied by all the triangles). One thing which strikes me is to find the height of each triangle - but I'm not able to proceed further.
Some clue on this would be helpful please.

Calculate the angles of triangles using the cosine rule, hence work out the distance of your point from the given line.
For example, in the left diagram, the triangle 25-30-32 the angle opposite 30 is $$ \cos^{-1}\frac{25^2+32^2-30^2}{2\cdot 25\cdot 32} $$ Similarly, the angle opposite 15 in 32-15-42 is $$ \cos^{-1}\frac{32^2+42^2-15^2}{2\cdot 32\cdot 42} $$ so the distance of vertex 15-42 from line 25 is $$ 42\sin\left(\cos^{-1}\frac{25^2+32^2-30^2}{2\cdot 25\cdot 32} -\cos^{-1}\frac{32^2+42^2-15^2}{2\cdot 32\cdot 42} \right). $$