Search
⌘K

Leetcode 1726. Tuple with Same Product

Count the number of ordered 4-tuples (a,b,c,d) of distinct elements from nums such that a*b = c*d by grouping all element-pairs by their product and using combinatorics on the number of pairs per product (feasible in O(n^2) time with a hashmap).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.