solve the triangle problem.