n photo frames. Frame i is given as frames[i] = [w, h], its width and height. Two frames have the same shape if their width-to-height ratios are exactly equal, meaning one is a scaled copy of the other. Frames may not be rotated.
Return the number of index pairs i < j such that frames i and j have the same shape.frames=[[3, 2], [6, 4], [2, 3], [9, 6]] → 3
Frames 3×2, 6×4 and 9×6 all have ratio 3 : 2 and make three pairs. Frame 2×3 has ratio 2 : 3 and pairs with nobody.
frames=[[5, 7], [7, 5]] → 0
The ratios 5 : 7 and 7 : 5 differ, so there are no pairs.
frames=[[1, 1], [4, 4], [10, 10]] → 3
frames=[[3, 2], [6, 4], [2, 3], [9, 6]]
3
Run checks the first 3 tests in your browser. Submit checks all 85 tests on the server, hidden ones included.