From 2e33cc45e9be7aa343e3a14d6d78534a3382e06b Mon Sep 17 00:00:00 2001 From: maunish Date: Wed, 11 Jan 2023 08:59:47 +0530 Subject: [PATCH] Create 2001-number-of-pairs-of-interchangeable.cpp --- ...of-pairs-of-interchangeable-rectangles.cpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 cpp/2001-number-of-pairs-of-interchangeable-rectangles.cpp diff --git a/cpp/2001-number-of-pairs-of-interchangeable-rectangles.cpp b/cpp/2001-number-of-pairs-of-interchangeable-rectangles.cpp new file mode 100644 index 000000000..7bc66d5c9 --- /dev/null +++ b/cpp/2001-number-of-pairs-of-interchangeable-rectangles.cpp @@ -0,0 +1,38 @@ +/* + Approach: + Keep the track of the ratios in a hash map + + Time complexity : O(n) + Space complexity: O(n) + + n is number of rectangles +*/ + +class Solution { +public: + long long interchangeableRectangles(vector>& rectangles) { + + map hash; + long double ratio; + + long long answer=0; + + for(int i=0;i pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy