Integer triangles in Java
The challenge
You have to give the number of different integer triangles with one angle of 120 degrees which perimeters are under or equal a certain value. Each side of an integer triangle is an integer value.
with sides a, b, and c integers such that:
a + b + c <= max. perimeter
See some of the following cases
|
|
The solution in Java code
Option 1:
|
|
Option 2:
Option 3:
|
|
Test cases to validate our solution
|
|