During continuous trading sessions, automated monitoring engines at Citadel and Optiver track instantaneous market message rates. An array of integers rates of length records message arrival counts per millisecond across an auction period.
A peak rate occurs at index if rates[i] is strictly greater than its immediate neighbors:
For the boundary elements, assume virtual neighbors . You are guaranteed that no two adjacent elements are equal (rates[i] != rates[i+1] for all ).
Your Task
Implement the function find_peak_flow_rate_index(rates: list[int]) -> int that finds the index of any peak rate in time.
Constraints
rates[i] != rates[i+1] for all valid .Examples
rates = [1, 2, 3, 1]
# Index 2 (value 3) is greater than 2 and 1.
# Output: 2
rates = [1, 2, 1, 3, 5, 6, 4]
# Valid peak indices: 1 or 5.
# Output: 1 or 5