1
# Runtime: 1072 ms (Top 44.44%) | Memory: 42.9 MB (Top 86.75%)
2
class Solution:
3
def tupleSameProduct(self, nums: List[int]) -> int:
4

5
from itertools import combinations
6

7
mydict = defaultdict(int)
8
ans = 0
9

10
for a, b in combinations(nums, 2):
11
mydict[a * b] += 1
12

13
for i, j in mydict.items():
14
if j > 1:
15
ans += (j * (j - 1) // 2) * 8
16

17
return ans

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0