Pergunta de entrevista da empresa Tesla

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