Day - 50
Assalamu alaykum, everyone!
Today is 50 days since I started my challenge. You see, time is passing very quickly. For me personally, it felt like time passed very quickly. My challenges are getting more complicated day by day. Because the topics on which I have a foundation are decreasing, and new parts are being opened. I got a lot of stuff these days. These are knowledge, experience, team, etc. That's why I tell you to try such challenges yourself. Because I don't want to be the only one using it. Such challenges are especially important for people who have just entered the industry. Because not everyone trusts them. Because they don't have experience and skills yet. But they can show themselves to the public through such challenges. All you need to do is work tirelessly and be patient.
I would like you to invite your friends so that I can be even more active after this challenge. I feel happy if I can help someone by sharing useful pieces like this.
So, let's start coding!
领英推荐
/*
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number[]}
*/
var intersect = function (nums1, nums2) {
let map1 = [],
len1 = nums1.length,
len2 = nums2.length,
index = 0;
while (index < len1) {
if (!map1[nums1[index]]) map1[nums1[index]] = 1;
else map1[nums1[index]] += 1;
index++;
}
let ans = [];
for (let i = 0; i < len2; i++) {
if (!map1[nums2[i]] || map1[nums2[i]] == 0) {
continue;
} else {
ans.push(nums2[i]);
map1[nums2[i]] -= 1;
}
}
return ans;
};
That's all I think. Thanks for your attention. Be active and support me via likes and shares. See you dears.