Creating triangles from given side lengths - Problem type 1