Tesla Interview Question

how to get the local peak min/max value using window functions or so