Hi,
The variant of Problem 6.7 asks us to solve the problem of buying and selling stock twice using only O(n) time and O(1) space. There’s an easy solution using O(n^2) time and O(1) space, but I can’t seem to get the time complexity down to O(n). Would you be able to provide a hint?
Thanks,