#3751
Total Waviness of Numbers in Range I
pupil · 445 · lc medium +26 · 80.6% accepted · 46 likes · top 92%
Description
Given integers num1 and num2, return the total waviness summed over all integers in [num1, num2], where a number's waviness counts interior digits that are strictly greater than both neighbors (peaks) or strictly less than both neighbors (valleys).
Code
1
2
3