Related: Name the poker hand
A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or below a two. An ace can rank either high (e.g. A♥ K♥ Q♥ J♥ 10♥ is an ace-high straight flush) or low (e.g. 5♦ 4♦ 3♦ 2♦ A♦ is a five-high straight flush), but cannot rank both high and low in the same hand (e.g. Q♣ K♣ A♣ 2♣ 3♣ is an ace-high flush, not a straight flush).
Challenge
Given N
cards (in any reasonable format) output a truthy value if a straight flush is contained in the poker hand.
Input
N
numbers of cards. (In any reasonable format)
There are four suits; hearts, spades, diamonds, and clubs (H, S, D, C)
.
Each suit has one card for the numbers 2 to 10, plus 4 'picture' cards, Ace, Jack, Queen, and King (A, J, Q, K)
Note: You can take 10 as T
Output
Truthy/Falsy
value
Test case
["AS", "2S", "3S", "4S", "5S"] => true
["3D", "9C", "4S", "KH", "AD", "AC"] => false
["5D", "6D", "7D", "8H", "9D", "10D", "JD"] => false
["JC", "7C", "5D", "8C", "AC", "10C", "9C", "5S"] =>true
[] => false
["AS", "2S", "3S"] => false
["JC", "QC", "KC", "AC", "2C"] => false
[ "2H", "3H", "4H", "5H", "6H", "7H"] => true
Standard code-golf rules apply.
Winning criteria: Shortest code in each lang
10
asT
? \$\endgroup\$