Google | Telephone interview coding question
Anonymous User
3798
- You are a traveling salesperson who travel back and forth between two cities X and Y.
- You are given with pair of arrays with selling price at each city (sp_X and sp_Y) each of length 'n' such that:
	- sp_X[i] =  selling-price of goods in city X on day i;
	- sp_Y[i] =  selling-price of goods in city Y on day i;
- You can only sell goods in one city per day.
- At the end of the day, you can choose to travel to another city but it will cost a constant amount of money (cost).

Given these inputs, write a function which will return the maximum profit attainable from some schedule in which each day 
is spent in one of the two cities

profit  = (selling_price - travel-cost)

def maximum_profit(sp_X, sp_Y, cost):
	# code goes here
Comments (12)