Wrote the C and Java solutions for stock maximize