Adding solution for histogram problem: