https://ideas.creativecasinoties.com/post/kadanes-algorithm-p2-2hcmzx