A subarray is good if consecutive values always go up by 1 or always go down by 1. Add up the sums of all good subarrays.
A subarray is good if consecutive values always go up by 1 or always go down by 1. Add up the sums of all good subarrays.
The discussion opens with the full question.