Polygon Possibility(hackerearth.2)

You are given length of n sides, you need to answer whether it is possible to make n sided convex polygon with it.

Input : -

First line contains T,no .of testcases.

For each test case , first line consist of single integer N,second line consist of N (l1,l2ln)spaced integers, size of each side.

Output : -

For each test case print "Yes" if it is possible to make polygon or else "No" if it is not possible.

1T10

1n105

1li104

SAMPLE INPUT
 
2
3
4 3 2 
4
1 2 1 4 
SAMPLE OUTPUT
 
Yes 

No  






t=int(input())
for i in range(t):
    n=int(input())
    lst=list(map(int,input().split()))
    sum_of_all_side=sum(lst)
    largset_side_length=max(lst)
    if(sum_of_all_side-largset_side_length>largset_side_length):
        print("Yes")
    else:
        print("No")

Comments

Popular posts from this blog

c++ oops

Takeoff (hackerearth.3, datastructure, array 1-D)

Aptitude tricks