Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1].
Leetcode 34. Find First and Last Position of Element in Sorted Array
Given a sorted (non-decreasing) array, return the starting and ending indices of a target value (or [-1, -1] if it’s not present). The challenge is to do this in O(log n) time by locating the leftmost and rightmost occurrences (e.g., with binary-search boundary searches).
Onde essa pergunta já apareceu
Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.
Sem observação adicional neste relato público.
Materiais associados
Nenhum anexo público associado a esta pergunta.
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.