HackerEarth Triangular Ranges problem solution - TheCScience