Max Money from K Consecutive Bags

Asked at Amazon · Coding Questions · Difficulty: Medium

Bags are laid out on a number line by range segments. You are given `k` (the number of consecutive positions you take) and `segments`, where each `segment[i] = [start, end, money]` means every position in `[start, end]` (inclusive) holds `money`. Positions not covered by any segment hold 0.

Loading the problem…