Motorola Solutions interview question

Water storage problem from leetcode