#3753

Total Waviness of Numbers in Range II

international master · 2095 · lc hard +32 · 25.4% accepted · 37 likes · top 4%

Description

Given integers num1 and num2, return the total sum of waviness for every number in the inclusive range [num1, num2], where waviness counts interior digits that are either strictly larger than both neighbors (peaks) or strictly smaller than both neighbors (valleys), modulo 109 + 7.

Code

1
2
3