C ++ implementation of above approach
#include <bits/stdc++.h> NEW_LINE using namespace std ; int max_profit ( int a [ ] , int b [ ] , int n , int fee ) { int i , j , profit ; int l , r , diff_day = 1 , sum = 0 ;