Optimize function

 

 

Rewrite the function for it to have O(n) time complexity. Add explanations (±300 words)

const n = 1000;

const array1 = [];
const array2 = [];

for(let i=0;i

Our customer support team is here to answer your questions. Ask us anything!