UBS Interview Question

Buy and Sell Stock standard problem