HackerEarth Benny and Segments problem solution - TheCScience