Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

257
Views
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 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!