算法一:正确率90%,算法效率分0%
算法二:正确率,算法效率均100%
public class Triangle {
public static void main(String[] args) {
int[] str = {10,2,5,1,8,20};
System.out.println(solution(str));
System.out.println(solution2(str));
}
//56分 https://codility.com/demo/results/training4X29ZE-2G5/
public static int solution(int[] A){
int length = A.length;
int count = 0;
for(int i = 0; i < length; i ++){
int a = A[i];
for(int j = i + 1; j < length; j ++){
int b = A[j];
for(int z = j + 1; z < length; z ++){
int c = A[z];
if(isTrangle(a,b,c)){
count ++;
}
}
}
}
if(count > 0){
ret