350. Intersection of Two Arrays II || In JAVA || Easy || Leetcode Problem #leetcode

preview_player
Показать описание
Hello Friends,
here I have discussed a leetcode problem. I solved this in JAVA.
I hope this video will help you.:)
Feel free to ask if you have any questions and you can give me any suggestions that I can improve!

Thanks for watching!

Leetcode Problems:
Рекомендации по теме
Комментарии
Автор

Code :-

class Solution {
public int[] intersect(int[] nums1, int[] nums2)
{
ArrayList<Integer> al = new ArrayList<>();

for(int i=0;i<nums1.length;i++){
for(int j=0;j<nums2.length;j++){
if(nums1[i] == nums2[j]){
al.add(nums2[j]);
nums2[j] = Integer.MAX_VALUE;
break;
}
}
}


int[] res = new int[al.size()];
int k=0;

for(int i : al){
res[k] = i;
k++;
}

return res;

}
}

quicklearninigwithsree
Автор

Sis i don't understand the max integer value... Please explain it with example 2

lotus-tktd
welcome to shbcf.ru