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

Leetcode 729. My Calendar I

Design a data structure that supports booking half-open intervals [start, end) so that book(start, end) returns true and inserts the interval only if it causes no overlap with existing bookings (otherwise returns false). With up to 1000 calls and times in [0, 1e9], typical solutions check neighbors in a sorted list or use a BST to detect overlaps efficiently.

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

Implement a room booking function that accepts start_time and end_time as parameters and returns True if the room can be booked or False otherwise. The function should handle overlapping time slots.

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.