HackerEarth Maximum subsequences problem solution - TheCScience