2001. Number of Pairs of Interchangeable Rectangles
https://leetcode.com/problems/number-of-pairs-of-interchangeable-rectangles
Description
You are given n
rectangles represented by a 0-indexed 2D integer array rectangles
, where rectangles[i] = [widthi, heighti]
denotes the width and height of the ith
rectangle.
Two rectangles i
and j
(i < j
) are considered interchangeable if they have the same width-to-height ratio. More formally, two rectangles are interchangeable if widthi/heighti == widthj/heightj
(using decimal division, not integer division).
Return the number of pairs of interchangeable rectangles in rectangles
.
Example 1:
Example 2:
Constraints:
n == rectangles.length
1 <= n <= 105
rectangles[i].length == 2
1 <= widthi, heighti <= 105
ac
Previous2000. Reverse Prefix of WordNext2002. Maximum Product of the Length of Two Palindromic Subsequences
Last updated