Skip to main content
added 31 characters in body
Source Link
Doorknob
  • 71.8k
  • 20
  • 143
  • 385

Mathematica, 2525 24 bytes

Tally@#~MatchQ~MatchQ[{{_,2}..}&]@*Tally

Try it online!Try it online!

The Tally function returns a list of the form {{elementelement, countcount}, ...}, which is then matched against a pattern that checks whether all countcount are 2.

Mathematica, 25 bytes

Tally@#~MatchQ~{{_,2}..}&

Try it online!

The Tally function returns a list of the form {{element, count}, ...}, which is then matched against a pattern that checks whether all count are 2.

Mathematica, 25 24 bytes

MatchQ[{{_,2}..}]@*Tally

Try it online!

The Tally function returns a list of the form {{element, count}, ...}, which is then matched against a pattern that checks whether all count are 2.

Source Link
Doorknob
  • 71.8k
  • 20
  • 143
  • 385

Mathematica, 25 bytes

Tally@#~MatchQ~{{_,2}..}&

Try it online!

The Tally function returns a list of the form {{element, count}, ...}, which is then matched against a pattern that checks whether all count are 2.