Given two integers num1 and num2, calculate the sum of the waviness of all integers in the inclusive range [num1, num2].
The waviness of an integer is defined as the total number of peak digits and valley digits it contains:
A digit is considered a peak if it is strictly greater than both its left and right adjacent digits.
A digit is considered a valley if it is strictly less than both its left and right adjacent digits.
First and last digits of a number cannot be peaks or valleys. Numbers with fewer than
Return the total waviness of all numbers in the given range.
Constraints:
num1 num2
Given two integers num1 and num2, calculate the sum of the waviness of all integers in the inclusive range [num1, num2].
The waviness of an integer is defined as the total number of peak digits and valley digits it contains:
A digit is considered a peak if it is strictly greater than both its left and right adjacent digits.
A digit is considered a valley if it is strictly less than both its left and right adjacent digits.
First and last digits of a number cannot be peaks or valleys. Numbers with fewer than
Return the total waviness of all numbers in the given range.
Constraints:
num1 num2