Created
September 4, 2015 11:57
-
-
Save xeonqq/a5fc033c372ce53a3ad0 to your computer and use it in GitHub Desktop.
Determine whether a triangle can be built from a given set of edges.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution(A): | |
# write your code in Python 2.7 | |
A.sort() | |
for i in xrange(len(A)-2): | |
if (((A[i] + A[i+1]) > A[i+2]) and ((A[i+2] + A[i+1]) > A[i]) and ((A[i+2] + A[i]) > A[i+1])): | |
return 1 | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment