Validate Health interview question

Variant of Trapping Water Leetcode Problem