
[LeetCode] 1726. Tuple with Same Product (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명 Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d. 문제 예제Example 1:Input: nums = [2,3,4,6]Output: 8Explanation: There are 8 valid tuples:(2,6,3,4) , (2,6,4,3) , (6,2,3,4) , (6,2,4,3)(3,4,2,6) , (4,3,2,6) , (3,4,6,2) , (4,3,6,2)Example 2:Input: nums = [..