Best Stretch Around One Item
The score of a stretch of nums (one or more items next to each other) is its smallest item times its number of items.
Return the largest score among the stretches that include position k.
Example 1
nums [2,6,5,9,3]
k 2
returns 15
The stretch [6, 5, 9] has smallest item 5 and three items: 15. Growing it further lets in the 2 or the 3.
Example 2
nums [7]
k 0
returns 7
The only stretch is the single item.
Constraints
1 <= len(nums) <= 3001 <= nums[i] <= 10**50 <= k < len(nums)
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.