a
and b
sorted in non-decreasing order (possibly with duplicates), return the count of the number of elements that appear in both arrays.
a
and b
are sorted!
muchInCommon([1, 2, 10], [2, 3, 4, 10]) → 2
muchInCommon([-5, 0, 0, 5], [0, 5]) → 2
muchInCommon([], [4, 8]) → 0
😳 TIME LEFT: seconds 😳
function muchInCommon(a, b) {
}
⏰ TOTAL TIME: seconds ⏰