J.P. Morgan Interview Question

Water level problem leetcode hard