Solve the flooding bar graph problem.