728x90
https://leetcode.com/problems/find-the-prefix-common-array-of-two-arrays
class Solution:
def findThePrefixCommonArray(self, A: List[int], B: List[int]) -> List[int]:
c = []
for i in range(1, len(A)+1):
count = 0
for j in range(i):
if A[j] in B[0:i]:
count += 1
c.append(count)
return c
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 2418. Sort the People (0) | 2024.03.02 |
---|---|
[Leetcode] 1817. Finding the Users Active Minutes (0) | 2024.02.28 |
[Leetcode] 2744. Find Maximum Number of String Pairs (0) | 2024.02.26 |
[Leetcode] 2103. Rings and Rods (1) | 2024.02.25 |
[Leetcode] 1347. Minimum Number of Steps to Make Two Strings Anagram (1) | 2024.02.24 |