Course Solutions Uncategorized (Solved) : List Consisting N Integers Given Triplet P Q R Triangular 0 P Q R N P Q R Q R P R P Q P Q Q36970954 . . . .

(Solved) : List Consisting N Integers Given Triplet P Q R Triangular 0 P Q R N P Q R Q R P R P Q P Q Q36970954 . . . .

 

An list A consisting of N integers is given. A triplet (P, Q, R)is triangular if 0 ≤ P < Q < R < N and:

A[P] + A[Q] > A[R],
A[Q] + A[R] > A[P],
A[R] + A[P] > A[Q].
Where P, Q and R are distinct elements. For example, consider listA such that:

A[0]=10 A[1]=2 A[2]=5

A[3]=1 A[4]=8 A[5]=20

Triplet (0, 2, 4) is triangular.

Write a function def triangular(A) that, given a list Aconsisting of N integers, if there exists a triangular tripletreturns a list containing triangular triplet or returns None ifthere is no triangular triplet. If there is more than onetriangular triplet, the first

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post