PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

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.

  • easy
  • Pinduoduo
  • Coding & Algorithms
  • Software Engineer

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.

Return whether the cards contain five consecutive ranks in the same suit, with ace high or low.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([('10','Hearts'),('J','Hearts'),('Q','Hearts'),('K','Hearts'),('A','Hearts'),('3','Clubs')],)

Expected Output: True

Explanation: High-ace straight flush.

Input: ([('A','Spades'),('2','Spades'),('3','Spades'),('4','Spades'),('5','Spades')],)

Expected Output: True

Explanation: Ace can be low.

Input: ([('2','Spades'),('3','Spades'),('4','Spades'),('5','Spades'),('7','Spades')],)

Expected Output: False

Explanation: Missing one rank prevents a straight flush.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find Shortest Square-Sum Path - Pinduoduo (hard)
  • Compute User Login Streaks - Pinduoduo (easy)
  • Design a Recency-Eviction Cache - Pinduoduo (medium)
  • Find missing rank in a straight - Pinduoduo (easy)
  • Find next greater element for subset - Pinduoduo (easy)