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
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