Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Union of two sorted arrays
// Intersection of two sorted arrays var arr1 = [1, 2, 3, 4]; var arr2 = [2, 4, 5]; //output : [2,4] var result = []; var i = 0; var j = 0; while(i < arr1.length && j < arr2.length) { if (arr1[i] < arr2[j]) { i++; } else if (arr2[j] < arr1[i]) { j++; } else { result.push(arr1[i]); i++; j++; } } console.log(result);
run
|
edit
|
history
|
help
0
Union of two sorted arrays
Holyboi
Counting digits
Get stack from error
Range List for JavaScript
Find the missing number in array
problem_name
A01 Implement Queue with Limited Size of Arrays
Tree Structure
Sort based on keys