Mahjong I: Is this a winning set? (retired)
Description:
Mahjong is an ancient game in China, which spreads all over the world. But how can we check if a set of tiles is a winning set?
To simplify the question, we assume that the tiles have only one suit. And we ignore the situation that it has chi-ed, pon-ed and kan-ed. You will get a string like "11122233344455" to describe a set of tiles. Your algorithm should return a boolean to tell if it's a winning set.
winning_set?('11122233344455') #-> true
winning_set?('11123456789999') #-> true
winning_set?('11223556677788') #-> false
Tips:
A set without chii, pon and kan will have exactly 14 tiles, and at most 4 of a kind.
Most of winning sets are like XXX-XXX-XXX-XXX-YY, in which XXX is ABC or AAA.
11122233344455 -> 111-222-333-444-55
11123456789999 -> 123-456-789-999-11
A special set of tiles is AABBCCDDEEFFGG means seven pairs, like 11224455667788. there should not be any same pairs in it (Japanese Mahjong rules).
Note: Four of a kind like AAAA can not appear in this special form.
Similar Kata:
Stats:
Created | Mar 31, 2016 |
Warriors Trained | 41 |
Total Skips | 11 |
Total Code Submissions | 91 |
Total Times Completed | 7 |
Ruby Completions | 6 |
Haskell Completions | 2 |
Total Stars | 1 |
% of votes with a positive feedback rating | 25% of 4 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 2 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |