728x90 반응형 IntersectWith1 349. Intersection of Two Arrays 주어진 두 개의 정수 배열에서 공통된 원소(교집합)를 찾는 문제입니다. 각 배열은 중복된 원소를 포함할 수 있지만, 교집합 결과에서 중복된 원소는 한 번만 나타나야 합니다. public int[] Intersection(int[] nums1, int[] nums2) { Dictionary dic = new Dictionary(); HashSet ret = new HashSet(); for(int i = 0;i 2023. 11. 7. 이전 1 다음 728x90 반응형