Function to return the maximum profit
int maxProfit ( int n , int k , int prices [ ] ) { int ans = 0 , buy = 0 , sell = 0 ; stack < pair < int , int > > transaction ; priority_queue < int > profits ; while ( sell < n ) { buy = sell ;