Novo curso: Como conseguir vagas remotas em empresas que pagam $120k+/ano
NaGringa
CodingMid-level

Leetcode 975. Odd Even Jump

Count how many starting indices can reach the end of an array by alternating odd/even jumps where an odd jump goes to the smallest-index j>i with arr[j] >= arr[i] and an even jump goes to the smallest-index j>i with arr[j] <= arr[i]. The core challenge is efficiently precomputing these next-higher/next-lower targets (e.g., via sorting + monotonic stack or an ordered map) and using DP to track which indices can reach the end.

Empresas em que apareceu
GoogleGoogle
Contextos reais

Onde essa pergunta já apareceu

Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.

Googlemidnov. de 2024

Array Jumping: Given an integer array A of size N, implement a function that returns the number of starting points from which you can reach the end of the array by jumping according to specific odd and even jump rules.

Anexos públicos

Materiais associados

Nenhum anexo público associado a esta pergunta.

Próximo passo

Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.

Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.

Continue a preparação com o banco completo

No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.