I was stuck in solving the following interview practice question: I have to write a function:
int triangle(int[] A);
that given a zero-
Python:
def solution(A): A.sort() for i in range(0,len(A)-2): if A[i]+A[i+1]>A[i+2]: return 1 return 0
Sorting: Loglinear complexity O(N log N)