There was an error while loading. Please reload this page.
1 parent 3a95d04 commit 8b1d818Copy full SHA for 8b1d818
3321-type-of-triangle/3321-type-of-triangle.java
@@ -0,0 +1,14 @@
1
+import java.util.*;
2
+
3
+class Solution {
4
+ public String triangleType(int[] nums) {
5
+ Arrays.sort(nums);
6
+ Set<Integer> set = new HashSet<>();
7
+ for (int num : nums) set.add(num);
8
9
+ if (nums[0] + nums[1] <= nums[2]) return "none";
10
+ if (set.size() == 1) return "equilateral";
11
+ if (set.size() == 2) return "isosceles";
12
+ return "scalene";
13
+ }
14
+}
0 commit comments