728x90
https://leetcode.com/problems/find-maximum-number-of-string-pairs
class Solution:
def maximumNumberOfStringPairs(self, words: List[str]) -> int:
count = 0
for i in range(len(words)):
for j in range(i+1, len(words)):
if words[i][::-1] == words[j]:
count += 1
return count
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 1817. Finding the Users Active Minutes (0) | 2024.02.28 |
---|---|
[Leetcode] 2657. Find the Prefix Common Array of Two Arrays (1) | 2024.02.28 |
[Leetcode] 2103. Rings and Rods (1) | 2024.02.25 |
[Leetcode] 1347. Minimum Number of Steps to Make Two Strings Anagram (1) | 2024.02.24 |
[Leetcode] 2913. Subarrays Distinct Element Sum of Squares I (0) | 2024.02.24 |