JSFiddle - React, Tailwind, and code Playground
by Alexandru Mihai
JavaScript
function missingNumbers(arr, brr) {
var a_hash = {}, b_hash = {}, result = [];
for(var i = 0 ; i < arr.length; i++){
if(!a_hash.hasOwnProperty(arr[i]))
a_hash[arr[i]] = 0;
a_hash[arr[i]]++;
}
for(var i = 0; i < brr.length; i++){
if(!b_hash.hasOwnProperty(brr[i]))
b_hash[brr[i]] = 0;
b_hash[brr[i]]++;
}
Object.keys(b_hash).forEach((key) => {
var diff = b_hash[key] - (a_hash[key] || 0);
for(var i = 0; i < diff; i++)
result.push(key);
});
return result;
}
console.log(missingNumbers('3696 3739 3714 3719 3687 3732 3657 3664 3717 3702 3741 3683 3660 3648 3649 3721 3652 3683 3694 3647 3696 3673 3741 3732 3677 3738 3666 3741 3701 3723 3721 3648 3654 3706 3743 3733 3704 3668 3660 3741 3730 3710 3729 3739 3662 3647 3701 3713 3674 3663 3690 3696 3719 3690 3728 3653 3734 3718 3722 3721 3725 3723 3703 3665 3668 3669 3654 3692 3699 3691 3682 3646 3649 3712 3688 3646 3662 3724 3705 3714 3692 3680 3690 3741 3693 3729 3664 3692 3660 3652 3718 3723 3684 3650 3685 3725 3679 3734 3710 3735 3685 3711 3672 3715 3739 3687 3660 3735 3674 3672 3674 3705 3666 3714 3710 3740 3656 3667 3655 3707 3710 3730 3695 3661 3713 3708 3688 3646 3653 3652 3701 3689 3657 3654 3647 3648 3656 3696 3730 3721 3712 3735 3651 3657 3716 3742 3704 3742 3705 3673 3680 3720 3727 3658 3738 3684 3653 3669 3656 3711 3734 3741 3743 3742 3655 3709 3743 3709 3697 3648 3667 3726 3717 3673 3700 3655 3651 3654 3728 3724 3651 3704 3687 3659 3656 3721 3663 3727 3725 3723 3660 3666 3664 3683 3678 3665 3681 3737 3714 3723 3660 3662 3724 3672 3657 3690 3718 3726 3714 3742 3689 3725 3706 3719 3674 3736 3712 3681 3701 3715 3738 3719 3714 3664 3659 3692 3651 3647 3722 3691 3647 3675 3700 3646 3706 3687 3685 3722 3740 3730 3732 3703 3730 3667 3667 3718 3720 3695 3711 3679 3656 3680 3677 3744 3740 3668 3710 3690 3724 3695 3692 3647 3717 3717 3682 3741 3681 3717 3691 3700 3659 3673 3705 3673 3672 3691 3686 3737...