Jump Trading's Card Set Detection Question
Jump Trading's assessment favors problems with many precise rules layered on top of each other, where the difficulty is bookkeeping, not cleverness. This card-set detection question defines six ranked sets and asks for the strongest one a hand can form, each with its own tie-break. Here is the full question, a structured Java solution, and a detailed rubric.
The question
Cards are strings like 10S or QH (rank then suit). Ranks run 2 to 10, J, Q, K, A; suits are S, H, D, C with S highest. Detect the strongest set a hand can form among six, returning its name and the cards that form it.
Ordered weakest to strongest: single card, pair, triple, five in a row (consecutive ranks), suit (five of one suit), a triple and a pair. Each set has its own tie-break.
The approach
Parse each card into a numeric rank and a suit. Group cards by rank and by suit once. Then test the sets from strongest to weakest and return the first that forms, so the strength ordering falls out for free.
import java.util.*;
class CardSets {
static class Results { String setName; List<String> cards;
Results(String n, List<String> c){ setName = n; cards = c; } }
private static int rankVal(String r) {
switch (r) { case "J": return 11; case "Q": return 12;
case "K": return 13; case "A": return 14; default: return Integer.parseInt(r); }
}
private static int suitVal(char s) { return "CDHS".indexOf(s); } // S highest
Results solution(List<String> hand) {
// rank -> cards, suit -> cards, in descending rank/suit convenience order
Map<Integer, List<String>> byRank = new HashMap<>();
Map<Character, List<String>> bySuit = new HashMap<>();
for (String card : hand) {
char suit = card.charAt(card.length() - 1);
int rank = rankVal(card.substring(0, card.length() - 1));
byRank.computeIfAbsent(rank, k -> new ArrayList<>()).add(card);
bySuit.computeIfAbsent(suit, k -> new ArrayList<>()).add(card);
}
Results r;
if ((r = tripleAndPair(byRank)) != null) return r; // strongest
if ((r = suit(bySuit)) != null) return r;
if ((r = fiveInARow(byRank)) != null) return r;
if ((r = ofAKind(byRank, 3, "triple")) != null) return r;
if ((r = ofAKind(byRank, 2, "pair")) != null) return r;
return single(byRank); // weakest, always exists
}
The detectors
Each set is a small function carrying its own tie-break: highest rank for n-of-a-kind, highest suit for a flush, the highest possible run for the straight, and highest triple then highest pair for the full house.
private Results single(Map<Integer, List<String>> byRank) {
int best = Collections.max(byRank.keySet());
return new Results("single card", List.of(byRank.get(best).get(0)));
}
private Results ofAKind(Map<Integer, List<String>> byRank, int n, String name) {
int bestRank = -1;
for (var e : byRank.entrySet())
if (e.getValue().size() >= n) bestRank = Math.max(bestRank, e.getKey());
if (bestRank == -1) return null;
return new Results(name, byRank.get(bestRank).subList(0, n));
}
private Results fiveInARow(Map<Integer, List<String>> byRank) {
for (int high = 14; high >= 6; high--) { // highest possible run first
boolean run = true;
for (int r = high; r > high - 5; r--) if (!byRank.containsKey(r)) { run = false; break; }
if (run) {
List<String> picked = new ArrayList<>();
for (int r = high; r > high - 5; r--) picked.add(byRank.get(r).get(0));
return new Results("five in a row", picked);
}
}
return null;
}
private Results suit(Map<Character, List<String>> bySuit) {
char bestSuit = 0; int bestVal = -1;
for (var e : bySuit.entrySet())
if (e.getValue().size() >= 5 && suitVal(e.getKey()) > bestVal) { bestVal = suitVal(e.getKey()); bestSuit = e.getKey(); }
if (bestVal == -1) return null;
return new Results("suit", bySuit.get(bestSuit).subList(0, 5));
}
private Results tripleAndPair(Map<Integer, List<String>> byRank) {
int triple = -1;
for (var e : byRank.entrySet()) if (e.getValue().size() >= 3) triple = Math.max(triple, e.getKey());
if (triple == -1) return null;
int pair = -1;
for (var e : byRank.entrySet())
if (e.getKey() != triple && e.getValue().size() >= 2) pair = Math.max(pair, e.getKey());
if (pair == -1) return null;
List<String> picked = new ArrayList<>(byRank.get(triple).subList(0, 3));
picked.addAll(byRank.get(pair).subList(0, 2));
return new Results("a triple and a pair", picked);
}
}
Testing strongest-first means the ordering is implicit, and each detector owns exactly one tie-break. The two places people slip are the ace-high straight bound and excluding the triple's rank when picking the pair.
How Jump Trading scores it
| Dimension | Weak | Strong |
|---|---|---|
| Parsing | Breaks on the ten rank or aces | Splits rank and suit correctly, maps J-A |
| Grouping | Re-scans the hand per set | Groups by rank and suit once, reused by all detectors |
| Strength order | Ad-hoc comparisons | Tests strongest to weakest, returns first match |
| Tie-breaking | Returns any valid set | Highest rank, highest suit, highest triple then pair |
| Straight logic | Off-by-one or wraps the ace | Highest possible run, no wraparound |
| Edge cases | Assumes a full hand | Handles few cards; single always forms |
This is one question of 16 pages
Get the full Jump Trading question bank
The full Jump Trading bank carries the online-assessment and on-site coding rounds, each problem with its follow-ups and a rubric, compiled from people familiar with the process and cross-verified across sources.
Jump Trading interview FAQ
What does the Jump Trading coding interview ask?+
Rule-heavy implementation problems, often as a timed online assessment. Card-set detection is typical: six sets of increasing strength, each scored separately, with exact tie-breaking rules you must get right.
How do you approach the card-set question?+
Parse cards into rank and suit, group by each, then check sets from strongest to weakest and return the first that forms. Structuring it as small detectors keeps the many tie-break rules manageable.
How is the Jump Trading assessment scored?+
Each set is scored separately, so partial correctness counts. Within a set, the tie-breaks (highest rank, highest suit, highest triple then highest pair) must be exact, and parsing and grouping must handle the ten-rank and ace cases.
Where can I find real Jump Trading interview questions?+
Pichup maintains a 16-page Jump Trading question bank compiled from people familiar with the process, with the assessment and on-site rounds, their follow-ups, and rubrics. The question in this guide is one of them.