Histogram Solution Error!

Can you help me with the error in my code. It’s giving correct output for smaller test cases :\

@ap8730390,
Your logic might be correct but the testcases are huge. So try using long instead of int.