We can assume that the answer is the current deal, initially it is the number suggested by the passenger, then the answer becomes the price of the taxi driver, then if the passenger can reduce the price then it will be the new answer, and then the taxi driver, We just need ot implement this process to get the final answer, also if the reduction or increase can't happen we just agree with the other price. There is one little tricky case to handle, if initially the offer of the passenger is higher then the offer of the driver then the answer is the offer of the passenger.
No comments:
Post a Comment