Back to problems

Find flush and straight groups in cards

Algorithm · Ziphq · Hard

Given an array cards whose elements are distinct playing card strings, each card is encoded as . The part is an integer from 1 to 13 written without leading zeroes, such as 1, 10, or 13. The part is one of C, D, H, or S. A group of cards is valid if it meets at least one of the following rules: It is a same-suit consecutive run: every card has the same suit, the numerical ranks can be ordered so that each rank is exactly one greater than the previous rank, and the group…

Checking your access…