PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Pinduoduo

Find missing rank in a straight

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to map and manipulate encoded card ranks, reason about consecutive sequences with Ace-as-low or Ace-as-high semantics, and identify a missing element within a constrained set.

  • easy
  • Pinduoduo
  • Coding & Algorithms
  • Software Engineer

Find missing rank in a straight

Company: Pinduoduo

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Onsite

You are given a list of **4 distinct characters** representing card ranks from a **5-card straight** (5 consecutive ranks) with **exactly one rank missing**. Ranks come from the set `{A,2,3,4,5,6,7,8,9,10,J,Q,K}`. To keep each rank as a single character, the input uses this encoding: - `'0'` represents **Ace** (`A`). - `'2'`–`'9'` represent ranks 2–9. - `'T'` represents 10. - `'J'`, `'Q'`, `'K'` represent Jack/Queen/King. Aces can be used as **low** in the straight `A-2-3-4-5` (treat Ace as value 1 in this case). Otherwise Ace is high above King. Return the **missing rank** using the same encoding (i.e., return `'0'` if the missing rank is Ace). Example: - Input: `['3','4','5','6']` → missing is `'2'` (straight `2-3-4-5-6`) - Input: `['0','2','3','5']` → missing is `'4'` (straight `A-2-3-4-5`)

Quick Answer: This question evaluates a candidate's ability to map and manipulate encoded card ranks, reason about consecutive sequences with Ace-as-low or Ace-as-high semantics, and identify a missing element within a constrained set.

Related Interview Questions

  • Find Shortest Square-Sum Path - Pinduoduo (hard)
  • Compute User Login Streaks - Pinduoduo (easy)
  • Determine Straight Flush - Pinduoduo (easy)
  • Design a Recency-Eviction Cache - Pinduoduo (medium)
  • Find next greater element for subset - Pinduoduo (easy)
Pinduoduo logo
Pinduoduo
Feb 19, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
6
0

You are given a list of 4 distinct characters representing card ranks from a 5-card straight (5 consecutive ranks) with exactly one rank missing.

Ranks come from the set {A,2,3,4,5,6,7,8,9,10,J,Q,K}. To keep each rank as a single character, the input uses this encoding:

  • '0' represents Ace ( A ).
  • '2' – '9' represent ranks 2–9.
  • 'T' represents 10.
  • 'J' , 'Q' , 'K' represent Jack/Queen/King.

Aces can be used as low in the straight A-2-3-4-5 (treat Ace as value 1 in this case). Otherwise Ace is high above King.

Return the missing rank using the same encoding (i.e., return '0' if the missing rank is Ace).

Example:

  • Input: ['3','4','5','6'] → missing is '2' (straight 2-3-4-5-6 )
  • Input: ['0','2','3','5'] → missing is '4' (straight A-2-3-4-5 )

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.