Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

266
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda