maximizing profit from stocks hackerrank solution python