Function to return the maximum profit
def maxProfit ( n , k , prices ) : NEW_LINE INDENT ans = 0 NEW_LINE buy = 0 NEW_LINE sell = 0 NEW_LINE transaction = [ ] NEW_LINE profits = [ ] NEW_LINE while ( sell < n ) : NEW_LINE INDENT buy = sell NEW_LINE DEDENT DEDENT