Infosys Interview Question

Stock buy and sell problem