Empresa engajada
Why Yelp? Tell me about a project you worked on lately. Given an array, return the smallest k elements from the array.
Sigiloso
in python: sorted(array)[0:k]
Sorting is O(nlogn). Better time complexity, store in priority queue then return an array of the last k elements. Time complexity: O(n).
^ That is not O(n). It is O(n + klogn) and you can do better than that.
Fique por dentro de todas as oportunidades e dicas internas seguindo as empresas de seus sonhos.
Comece a buscar vagas para receber atualizações e recomendações personalizadas.