Skip to content

Commit c5ca27a

Browse files
committed
Runtime: 1072 ms (Top 44.44%) | Memory: 42.9 MB (Top 86.75%)
1 parent 05bbc5e commit c5ca27a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
# Runtime: 1072 ms (Top 44.44%) | Memory: 42.9 MB (Top 86.75%)
12
class Solution:
23
def tupleSameProduct(self, nums: List[int]) -> int:
3-
4+
45
from itertools import combinations
56
mydict=defaultdict(int)
67
ans=0
7-
8+
89
for a,b in combinations(nums,2):
910
mydict[a*b]+=1
10-
11+
1112
for i,j in mydict.items():
1213
if j>1:
1314
ans+=(j*(j-1)//2)*8
14-
15-
return ans
15+
16+
return ans

0 commit comments

Comments
 (0)