Reported August 2024
JP Morgancounting

Count Teams

Reported by candidates from JP Morgan's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live JP Morgan OA. Under 2s to a working solution.
Founder's read

You're prepping for JP Morgan's OA in August and just saw 'Count Teams' in your invite. No problem text yet, but this one's about enumerating valid teams under certain constraints. The trick is recognizing whether you're counting combinations, permutations, or filtering by a specific rule (skill levels, hierarchy, availability). Most candidates overthink the constraint parsing. StealthCoder will catch the exact constraint and show you the right counting strategy when you're live.

Pattern and pitfall

Count Teams usually boils down to either combinatorics (nCr, nPr) or filtering an array by a rule then counting valid subsets. The pattern is often hash-table or array-based: build a frequency map, apply your constraint (maybe a sum, maybe a score threshold), then enumerate. Common miss: not recognizing when the constraint eliminates symmetry, turning a combination problem into a careful enumeration. Some versions layer in sorting or two-pointers to prune the search space efficiently. When you're live and the constraint hits you, StealthCoder reads it and shows the exact formula or brute-force path in seconds.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Count Teams cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass JP Morgan's OA.

JP Morgan reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Teams FAQ

Is this a pure math problem or does it need code?+

It's code-based. You'll store teams (likely as arrays or tuples) and check each one against the constraint, then count. The math (combinations, permutations) is the shortcut you spot after you understand the rule.

What's the constraint likely to be?+

JP Morgan problems often involve ranking, skill scores, or hierarchical rules. Watch for 'team strength must be X', 'must include role Y', or 'no two people from same department'. Read that constraint three times before coding.

Brute force or optimized?+

If n is small (under 20), brute force all combinations and filter. If n is larger, you'll need two-pointers or binary search on a sorted array to prune. Check the constraint first; it often cuts the search space hard.

Will I need a hash-table?+

Probably. Use it to track attributes (skill, department, role) so you can validate the constraint quickly for each candidate team. Saves repeated scans.

How much time should this take?+

Understand the constraint (5 min), write brute force (10 min), optimize if needed (10 min). Total 20-30 min if you don't second-guess the rule. The constraint is the hard part, not the code.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with JP Morgan.

OA at JP Morgan?
Invisible during screen share
Get it