Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
What will be Time Complexity if we use include function inside the some function of array

As we know that Array.prototype.some() and Array.prototype.includes() has time complexity of o(n). Now I want to know that what if I will use include inside some method. The time complexity will be linear or quadratic?

function checkDublicate (arr1, arr2) {
return arr1.some(item => arr2.includes(item));
}
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It's O(mn), where m is arr1.length and n is arr2.length.

about 4 years ago · Juan Pablo Isaza Relatório

0

Considering the worst case scenario, if arr2 has no items from arr1, all n elements will be searched in arr2, with each search having O(n) complexity. Overall complexity will be O(n^2) (assuming n elements in either array).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda