J.P. Morgan interview prep

Practice 30 problems from community-reported J.P. Morgan interviews.

Start practicing Group Anagrams

Ranked problems

30 problems
J.P. Morgan interview prep, ordered by rank
ProblemDifficultyCompany lists
Hash tables

Group words that contain exactly the same letters with the same counts, regardless of order.

On the Amazon, Google, Meta, Oracle, J.P. Morgan, Morgan Stanley lists.

Medium
Counting

Count binary substrings made of two consecutive runs of equal length, one of zeros and one of ones in either order.

On the IBM, J.P. Morgan lists.

Easy
Hash tables

Find the indices of two different elements in an array whose values add up to a given target.

On the Amazon, Google, Microsoft, Meta, Samsung, Tekion, IBM, Oracle, J.P. Morgan, Morgan Stanley lists.

Try [2, 7, 11, 15] with a target of 9.

Reveal the indices

[0, 1] points to 2 and 7.

Easy
Arrays

Rotate a square matrix 90 degrees clockwise in place.

On the J.P. Morgan list.

Medium
Intervals · LeetCode Premium

Given meeting start and end times, find the fewest rooms needed so every meeting can run on schedule.

On the Tekion, Oracle, J.P. Morgan lists.

Medium
Sliding window

Find the length of the longest contiguous stretch of a string in which no character appears twice.

On the Amazon, Google, Microsoft, Meta, Tekion, IBM, Oracle, J.P. Morgan, Morgan Stanley lists.

Medium
Arrays

Given daily prices, find the best profit from buying once and selling on a later day. Return zero if no trade makes money.

On the Amazon, Google, Microsoft, Meta, IBM, J.P. Morgan, Morgan Stanley lists.

Easy
Counting

Check whether the digit at every index i equals the number of occurrences of digit i in the entire string.

On the J.P. Morgan list.

Easy
Greedy

Two strings contain only x and y. Find the fewest cross-string character swaps needed to make the strings identical, or report that it is impossible.

On the J.P. Morgan list.

Medium
Trees

Reverse the node values at each odd depth of a perfect binary tree. Keep the tree structure intact.

On the J.P. Morgan list.

Medium
Hash tables

Turn orders into a table with one row per table number and one column per food, sorting the table numbers numerically and the foods alphabetically.

On the J.P. Morgan list.

Medium
Heaps

For each threshold, count the cells reachable from the top-left corner by moving through cells whose values are strictly below it.

On the J.P. Morgan list.

Hard
Breadth-first search

Find the smallest digit string reachable by repeatedly rotating right by a fixed amount or adding a fixed digit modulo ten at odd indices.

On the J.P. Morgan list.

Medium
Math

Given a coordinate such as a1 or h8, determine whether the corresponding chessboard square is white.

On the J.P. Morgan list.

Easy
Greedy

Find the smallest digit string you can make with at most one swap of adjacent digits of the same parity.

On the J.P. Morgan list.

Easy
Arrays

Use a time-ordered log to find the button with the longest single press. Choose the lowest button index if durations tie.

On the J.P. Morgan list.

Easy
Counting

Find the fewest character replacements in the second string needed to make it an anagram of the first.

On the J.P. Morgan list.

Medium
Monotonic queue

Slide a window of k elements across an array one position at a time and return the largest value in each window.

On the Microsoft, Oracle, J.P. Morgan lists.

Hard
Two pointers

Pair players so every pair has the same total skill. Sum the products of paired skills, or return −1 if no valid pairing exists.

On the J.P. Morgan list.

Medium
Arrays

Find the shortest prefix you can remove so the remaining array is strictly increasing.

On the J.P. Morgan list.

Medium
Intervals

Combine overlapping intervals and return a list that covers the same ranges without overlaps.

On the Amazon, Microsoft, IBM, Oracle, J.P. Morgan, Morgan Stanley lists.

Medium
Strings

Whenever two neighboring words are anagrams, discard the second. Return the words left when no such pair remains.

On the J.P. Morgan list.

Easy
Arrays

Pick two different positions, subtract one from each selected value, and maximize the product of the results.

On the Samsung, J.P. Morgan lists.

Easy
Greedy

Reorder an integer array to maximize the number of its prefix sums that are strictly positive.

On the J.P. Morgan list.

Medium
Data structure design

Design a fixed-capacity cache with constant-time reads and writes. When it fills up, evict the least recently used key.

On the Amazon, Microsoft, Samsung, Oracle, J.P. Morgan, Morgan Stanley lists.

Medium
Greedy

Build the lexicographically largest string from some or all of the given letters while keeping every consecutive run within the repeat limit.

On the J.P. Morgan list.

Medium
Prefix sums

Count how many nonempty contiguous parts of an integer array have a sum of exactly k.

On the Amazon, Google, Microsoft, Meta, IBM, J.P. Morgan lists.

Medium
Greedy

Load a truck with a limited number of boxes. Choose from box types with different unit counts to maximize the total units carried.

On the J.P. Morgan list.

Easy
Strings

Return the longest contiguous part of a string that reads the same forward and backward.

On the Amazon, Google, Microsoft, Meta, Tekion, IBM, Oracle, J.P. Morgan lists.

Medium
Heaps · LeetCode Premium

Joining two sticks costs the sum of their lengths. Choose the joining order that minimizes the total cost of making one stick.

On the J.P. Morgan list.

Medium
How are questions ranked?

Company lists follow community-reported interview frequency. Ties keep the source order. Where a list uses two sources, we keep the first list’s ranks and fill the remaining places with the highest-ranked distinct problems from the second.

Across companies, first place earns 30 points and each subsequent rank earns one fewer. We add each problem’s points and break ties alphabetically.