Practice Tuple with Same Product
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Tuple with Same Product on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [2,3,4,6]
Output
8
# Example 2
Input
nums = [1,2,4,5,10]
Output
16
Constraints
1 <= nums.length <= 1000
1 <= nums[i] <= 10^4
All elements in nums are distinct.
Related LeetCode Problems
Practice more problems similar to Tuple with Same Product.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.