Morgan Stanley interview prep

Practice 30 problems from community-reported Morgan Stanley interviews.

Start practicing Best Time to Buy and Sell Stock

Ranked problems

30 problems
Morgan Stanley interview prep, ordered by rank
ProblemDifficultyCompany lists
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
Dynamic programming

Select players to maximize total score while ensuring no younger teammate scores more than an older teammate.

On the Morgan Stanley list.

Medium
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
Greedy

Gather every chip at one position. A step of two positions is free and a step of one costs one. Minimize the total cost.

On the Morgan Stanley list.

Easy
Binary search

For every obstacle, find the longest nondecreasing subsequence of heights that ends at that exact position.

On the Morgan Stanley list.

Hard
Geometry · LeetCode Premium

Find the smallest number of straight lines needed so that every supplied point lies on at least one of them.

On the Morgan Stanley list.

Medium
Hash tables

Decide whether two different starting positions in an array have the same sum of two consecutive elements.

On the Morgan Stanley list.

Easy
Arrays

Use sequential task completion logs to identify who performed the longest individual task. Break a tie with the smallest employee ID.

On the Morgan Stanley list.

Easy
Bit manipulation

Reconstruct an integer array when each supplied entry is the XOR of all original values up to that position.

On the Morgan Stanley list.

Medium
Dynamic programming

Choosing a number earns its value and eliminates all occurrences of its neighboring values. Find the highest score you can earn.

On the IBM, Morgan Stanley 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
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
Linked lists

Deep-copy a linked list whose nodes also point to arbitrary nodes or null. All copied pointers must refer to the corresponding copies or null.

On the Morgan Stanley 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
Math

Decide whether the decimal digits of an integer read the same from either end.

On the Amazon, Google, Microsoft, Meta, Morgan Stanley lists.

Easy
Counting

Return the index of the first character that appears exactly once, or −1 when every character repeats.

On the Morgan Stanley list.

Easy
Two pointers

Reorder an array containing only 0, 1 and 2 into ascending order in place without calling a library sort.

On the Morgan Stanley list.

Medium
Sliding window

Count contiguous subarrays whose smallest value equals the given lower bound and whose largest equals the given upper bound.

On the Morgan Stanley list.

Hard
Heaps

Find the value in position k when the array is ordered from largest to smallest, counting duplicates.

On the Meta, Morgan Stanley lists.

Medium
Two pointers

Find every distinct triple of values that adds up to zero, using three different positions in the array.

On the Amazon, Google, Microsoft, Meta, Samsung, Oracle, Morgan Stanley lists.

Medium
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
Greedy

Find a sequence of stamp placements that spells the target on a blank strip. Later stamps may overwrite earlier letters.

On the Morgan Stanley list.

Hard
Arrays

Return every entry in a rectangular matrix in clockwise spiral order, starting at the top-left corner.

On the Oracle, Morgan Stanley lists.

Medium
Dynamic programming

Find the largest product of a nonempty contiguous segment of an integer array that may include zeros and negative numbers.

On the Morgan Stanley list.

Medium
Stacks

For each daily temperature, report how many days you must wait for a warmer reading. Use zero if none follows.

On the Tekion, Morgan Stanley lists.

Medium
Linked lists

Remove the nth node counted from the end of a singly linked list, then return the resulting head.

On the Morgan Stanley list.

Medium
Greedy

Each array entry gives the farthest jump allowed from that position. Decide whether you can reach the last index from the first.

On the Morgan Stanley list.

Medium
Prefix sums

Find the longest contiguous segment of a binary array that contains just as many zeros as ones.

On the Morgan Stanley list.

Medium
Two pointers

Compact a sorted array in place so each distinct value appears once at the front, then return the number of distinct values.

On the Google, Microsoft, Meta, Morgan Stanley lists.

Easy
Backtracking

Generate every correctly nested string that uses exactly n pairs of parentheses.

On the Morgan Stanley 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.