Determine Straight Flush
Company: Pinduoduo
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Implement a function that determines whether a set of poker cards contains a **straight flush**.
You are given a list of unique playing cards. Each card has:
- a **rank**: one of `2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A`
- a **suit**: one of `Spades, Hearts, Diamonds, Clubs`
A **straight flush** is a set of 5 cards that:
1. all have the same suit, and
2. have 5 consecutive ranks.
Assume:
- `A` may be used either as low in `A-2-3-4-5` or as high in `10-J-Q-K-A`
- the input contains no duplicate cards
Return `true` if at least one straight flush exists in the given cards, otherwise return `false`.
Example:
- Input: `[(10, Hearts), (J, Hearts), (Q, Hearts), (K, Hearts), (A, Hearts), (3, Clubs)]`
- Output: `true`
- Input: `[(2, Spades), (3, Spades), (4, Spades), (5, Spades), (7, Spades)]`
- Output: `false`
Quick Answer: This question evaluates competency in algorithmic pattern detection and data-structure manipulation applied to domain-specific representations, focusing on identifying ordered sequences and uniform attributes within a set of items.