Consecutive Differences — Solution & Editorial
One pass of pairwise subtraction — the discrete derivative that inverts prefix sums.
Complexity: O(N)
One pass of pairwise subtraction — the discrete derivative that inverts prefix sums.
Complexity: O(N)