https://leetcode.com/problems/find-common-elements-between-two-arrays/description/
Find Common Elements Between Two Arrays - LeetCode
Can you solve this real interview question? Find Common Elements Between Two Arrays - You are given two 0-indexed integer arrays nums1 and nums2 of sizes n and m, respectively. Consider calculating the following values: * The number of indices i such that
leetcode.com
1 2 3 4 5 6 7 8 9 10 11 | class Solution: def findIntersectionValues(self, nums1: List[int], nums2: List[int]) -> List[int]: answer = [0, 0] for num in nums1: if num in nums2: answer[0] += 1 for num in nums2: if num in nums1: answer[1] += 1 return answer | cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode CodeTestcaseTestcaseTest Result2942. Find Words Containing Character (0) | 2023.12.27 |
---|---|
leetcode 2951. Find the Peaks (0) | 2023.12.27 |
leetcode 2965. Find Missing and Repeated Values (0) | 2023.12.27 |
백준 4388 받아올림 (0) | 2023.12.27 |
백준 6550 부분 문자열 (2) | 2023.12.23 |
댓글