Acute, Obtuse, or Right?
Description:
In this Kata, you will be given an array of side lengths for a triangle.Your job is to figure out whether the triangle should be classified as Right, Acute, or Obtuse. To learn more about Right, Acute, or Obtuse triangles see here - Acute and Obtuse Triangles
Recall that a in a right triangle, one of the three angles has a value of 90°, in an obtuse angle one of the three angles has a value greater than 90°, and in an acute triangle all three of the angles have measures less than 90°.
The array given will always contain 3 positive integers, and the order of the integers may be random. The side lengths may not produce a valid triangle.
Recall that the sum of the 2 shortest sides of the triangle must be greater than the largest side (hypotenuse) in order for a triangle to be considered valid.
Your function will contain a single array as an argument, such as -
function obtRhtAct([SIDE_LEN_1,SIDE_LEN_2,SIDE_LEN_3]) {
//your code here
return -1
}
Your function should return the following values -
if (triangle is obtuse) => 0
if (triangle is right) => 1
if (triangle is acute) => 2
if (triangle is invalid) => -1
Similar Kata:
Stats:
Created | Dec 11, 2017 |
Published | Dec 11, 2017 |
Warriors Trained | 290 |
Total Skips | 2 |
Total Code Submissions | 577 |
Total Times Completed | 160 |
JavaScript Completions | 160 |
Total Stars | 3 |
% of votes with a positive feedback rating | 83% of 59 |
Total "Very Satisfied" Votes | 41 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 3 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |