From 6f1c9ad38b496cc409d591f29ba750d5b086d936 Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Thu, 6 Feb 2025 20:43:59 +0530 Subject: [PATCH] Create 1726. Tuple with Same Product --- 1726. Tuple with Same Product | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 1726. Tuple with Same Product diff --git a/1726. Tuple with Same Product b/1726. Tuple with Same Product new file mode 100644 index 0000000..5e25612 --- /dev/null +++ b/1726. Tuple with Same Product @@ -0,0 +1,12 @@ +class Solution { + public: + int tupleSameProduct(vector& nums) { + int ans = 0; + unordered_map count; + for (int i = 0; i < nums.size(); ++i){ + for (int j = 0; j < i; ++j) + ans += count[nums[i] * nums[j]]++ * 8; + } + return ans; + } +};