Description
Countdown
Design a hardware module that counts countdown sequences in an array. A countdown of length K starting at position i means arr[i]=K, arr[i+1]=K-1, ..., arr[i+K-1]=1. Find all such countdown sequences and their positions.
Example: For [7,4,3,2,1,4,3,2,1] with k=4, find countdown sequences of length 4: [4,3,2,1] starting at position 1 and position 5.
Source: Google Kickstart 2020 Round C - Problem A: Countdown
Input
a
Stream of 32-bit Unsigned IntegerArray of countdown numbers.
k
32-bit Unsigned IntegerCountdown sequence length.
Output
32-bit Unsigned Integer
Number of complete countdown sequences.