How would you solve a variation of LeetCode 528?
Given a table of choices with positive, zero, or NULL weights and a supplied random_value, return the single choice whose weighted interval contains that value. Treat the random value as belonging to the half-open range from zero through, but not including, the total positive weight.
choice_id, choice_label, weight, cumulative_weight, and random_value.choice_id.| Column | Type | Description |
|---|---|---|
| choice_idPK | INT | Stable identifier used to order choices |
| choice_label | VARCHAR(100) | Human-readable choice label |
| weight | NUMERIC(10,2) | Weight determining the size of the choice interval |