tiles, where tiles[i] = [a, b] are the numbers on the two halves of tile i.
Two tiles match if one can be turned around to look exactly like the other: [a, b] matches both [a, b] and [b, a].
Return the number of index pairs i < j such that tiles[i] and tiles[j] match.tiles=[[3, 5], [5, 3], [3, 3], [2, 6]] → 1
Only [3, 5] and [5, 3] match: just turn the second one around.
tiles=[[4, 1], [1, 4], [4, 1], [6, 6]] → 3
Three identical tiles (allowing a turn) form three pairs.
tiles=[[9, 9]] → 0
tiles=[[3, 5], [5, 3], [3, 3], [2, 6]]
1
Run checks the first 3 tests in your browser. Submit checks all 91 tests on the server, hidden ones included.