The TransCompilator

Solved LeetCode program · 844 of 1,000

#1128 · Number of Equivalent Domino Pairs

Easy Array chunk-17.md

Original English source

The dominoes is a list of 1, 2, 2, 1, 3, 4, 5, and 6. The counts is a list of 100 zeros. The total is 0.
For every domino from 0 to 3.
The base is domino times 2. The one is item base of dominoes. The other is item (base plus 1) of dominoes. The low is one. The high is other. If one is more than other, set low to other, set high to one. The key is low times 10 plus high. The seen is item key of counts. Add seen to total. Set item key of counts to seen plus 1.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

1