JPMorgan & Chase OA 2025: Key Questions & Solutions

1,488次閱讀

Preparing for the JPMorgan Chase Online Assessment ? Below are two core problems you’ll likely encounter, along with step-by-step solutions in Python.

JPMorgan & Chase OA 2025: Key Questions & Solutions

1. Distinct Digit Numbers

Problem: Given a range [n, m], count how many numbers have all distinct digits.

Approach

  1. For each num in range(n, m+1), convert to string.
  2. Use a set to check if len(set(digits)) == len(digits).
  3. Increment a counter when digits are unique.

Code

def count_distinct(n, m):
    count = 0
    for num in range(n, m + 1):
        s = str(num)
        if len(set(s)) == len(s):
            count += 1
    return count

# Example
print(count_distinct(10, 25))  # Outputs how many numbers between 10 and 25 have unique digits

2. First k-Winner in Queue Tournament

Problem: Players with integer “potentials” play in a queue. Each round, the front two compete; the higher‐potential wins, increments its consecutive win count, and the loser goes to the back. Find the first player to win k consecutive rounds.

Approach

  1. Initialize a deque of potentials.
  2. Pop the first as current_winner, set win_streak = 0.
  3. While win_streak < k:
    • Pop next_player.
    • If current_winner > next_player, increment win_streak, append loser.
    • Else, reset win_streak = 1, swap roles, append loser.
  4. Return current_winner once win_streak == k.

Code

from collections import deque

def first_k_winner(potentials, k):
    q = deque(potentials)
    current = q.popleft()
    streak = 0

    while streak < k:
        challenger = q.popleft()
        if current > challenger:
            streak += 1
            q.append(challenger)
        else:
            q.append(current)
            current = challenger
            streak = 1

    return current

# Example
print(first_k_winner([3, 1, 4, 2, 5], 3))  # Winner who wins 3 in a row

Next Steps & Tips

  • Practice these patterns on LeetCode or HackerRank.
  • Write clean, well-commented code and test edge cases.
  • Review JPMorgan’s hiring values and be ready for behavioral questions.

Good luck with your OA! For personalized coaching or mock assessments, contact us.

author avatar
Alex Ma Staff Software Engineer
目前就职于Google,10余年开发经验,目前担任Senior Solution Architect职位,北大计算机本硕,擅长各种算法、Java、C++等编程语言。在学校期间多次参加ACM、天池大数据等多项比赛,拥有多项顶级paper、专利等。
正文完