Ezvor

1788. Maximize the Beauty of the Garden

HardArray Preparing judge… LeetCode
ArrayHash TableGreedyPrefix Sum

Hints

Hint 1
Consider every possible beauty and its first and last index in flowers.
Hint 2
Remove all flowers with negative beauties within those indices.