Komprise Interview Question

Water trapping problem in coding round .