function to count triplets in a sorted doubly linked list whose sum is equal to a given value 'x
' NEW_LINE def countTriplets ( head , x ) : NEW_LINE INDENT ptr1 , ptr2 , ptr3 = Node ( 0 ) , Node ( 0 ) , Node ( 0 ) NEW_LINE count = 0 NEW_LINE DEDENT