To Calculate the value nCk
def f ( self , n , k ) : NEW_LINE INDENT if k == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT if n == k : NEW_LINE INDENT return 1 NEW_LINE DEDENT if n < k : NEW_LINE INDENT return 0 NEW_LINE DEDENT if self . ncr [ n ] [ k ] != - 1 : NEW_LINE INDENT return self . ncr [ n ] [ k ] NEW_LINE DEDENT DEDENT