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

Leetcode 2454. Next Greater Element IV

For each element in nums, find the first element to its right that is strictly greater and then the next strictly greater element after that (i.e., the "second greater" to the right), or return -1 if none exists. The challenge is to compute all answers efficiently for n up to 1e5, typically using monotonic-stack techniques to track candidate indices.

Empresas em que apareceu
DoorDashDoorDash
Contextos reais

Onde essa pergunta já apareceu

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

DoorDashstaff_plusjun. de 2025

Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1. Note that the returned integer should fit in 32-bit integer, if there is a valid answer but it does not fit in 32-bit integer, return -1.

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.