PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Pinduoduo

Determine Straight Flush

Last updated: Apr 2, 2026

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.

Related Interview 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)
Pinduoduo logo
Pinduoduo
Mar 15, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

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

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Pinduoduo•More Software Engineer•Pinduoduo Software Engineer•Pinduoduo Coding & Algorithms•Software Engineer Coding & Algorithms
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.