Count of triplets of numbers 1 to N such that middle element is always largest | Function to find Number of triplets for given Number N such that middle element is always greater than left and right side element . ; Check if arrangement is possible or Not ; Else return total ways ; Driver code .
def findArrangement ( N ) : NEW_LINE INDENT if ( N < 3 ) : NEW_LINE INDENT return 0 ; NEW_LINE DEDENT return ( ( N ) * ( N - 1 ) * ( N - 2 ) ) // 3 ; NEW_LINE DEDENT N = 10 ; NEW_LINE print ( findArrangement ( N ) ) ; NEW_LINE