Morgan Stanley interview experience Real time questions & tips from candidates to crack your interview

Tech Analyst

Morgan Stanley
upvote
share-icon
4 rounds | 12 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Data Structures and Algorithms, OOPS, SQL, Operating System, Low Level Design
Tip
Tip

Tip 1 : Add atleast 2 good projects in your resume about which you can talk for atleast 10 minutes.
Tip 2 : Solve company tagged questions before interview

Application process
Where: Referral
Eligibility: No backlogs
Resume Tip
Resume tip

Tip 1 : Resume should be strictly 1 pager
Tip 2 : Mention all important details like your email, mobile number etc.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 Minutes
Interview date29 May 2022
Coding problem3

1. Validate BST

Moderate
25m average time
0/80
Asked in companies
FacebookAmazonFreshworks

You have been given a binary tree of integers with N number of nodes. Your task is to check if that input tree is a BST (Binary Search Tree) or not.

A binary search tree (BST) is a binary tree data structure which has the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
Example :

BST1

Answer :

Level 1: 

All the nodes in the left subtree of 4 (2, 1, 3) are smaller 
than 4, all the nodes in the right subtree of the 4 (5) are 
larger than 4.

Level 2 :

For node 2:
All the nodes in the left subtree of 2 (1) are smaller than 
2, all the nodes in the right subtree of the 2 (3) are larger than 2.
For node 5:
The left and right subtrees for node 5 are empty.

Level 3:

For node 1:
The left and right subtrees for node 1 are empty.
For node 3:
The left and right subtrees for node 3 are empty.

Because all the nodes follow the property of a binary search tree, the above tree is a binary search tree.
Problem approach

I solved this question using preorder recursion in O(n) time

Try solving now

2. Find K Closest Elements

Moderate
15m average time
85% success
0/80
Asked in companies
UberFacebookOYO

You are given a sorted array 'A' of length 'N', two integers 'K' and 'X'. Your task is to print 'K' integers closest to 'X', if two integers are at the same distance return the smaller one.

The output should also be in sorted order

Note:
An integer 'a' is closer to 'X' than an integer 'b' if: 
|a - X| < |b - X|  or (  |a - X| == |b - X| and a < b )
For Example:
if X = 4,  3 is closer to 'X' than 9, as |3-4| < |9-4|  i.e., 1 < 5   and if X = 4, 2 and 6 are equally close to it, as |2-4| == |6-4| = 2, but we say 2 is closer to 4 than 6, as 2 is smaller.
Problem approach

I solved this question using a heap data structure in O(nlogk) time

Try solving now

3. Majority Element - II

Easy
10m average time
90% success
0/40
Asked in companies
GoogleMorgan StanleyAmazon

You are given an array/list 'ARR' of integers of length ‘N’. You are supposed to find all the elements that occur strictly more than floor(N/3) times in the given array/list.

Problem approach

Solved this question using Boyer Moore Voting algorithm in O(n) time

Try solving now
02
Round
Easy
Video Call
Duration60 Minutes
Interview date23 Jun 2022
Coding problem3

1. Binary Strings Without Consecutive 1's

Moderate
0/80
Asked in companies
FlipkartMorgan StanleyMicrosoft

You are given an integer ‘N’, you need to find the count of binary strings of length equal to ‘N’ that do not contain consecutive 1’s. As the answer can be large, print its value modulo 10^9 + 7.

Follow up :
Can you try to solve this problem in O(N) time and O(1) space?
Example :
If ‘N’ = 3

Then there are 5 possible binary strings of length equal to 3 that do not contain consecutive 1’s: “000”, “001”, “010”, “100”, “101”.
Try solving now

2. Encode the Message

Easy
18m average time
90% success
0/40
Asked in companies
MicrosoftAmazonWalmart

You have been given a text message. You have to return the Run-length Encoding of the given message.

Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as the character and a single count. For example, the string "aaaabbbccdaa" would be encoded as "a4b3c2d1a2".

Try solving now

3. OS Questions

what is cache?
what is round robin?
what is banker's algorithm?
what is multitasking?
preemptive vs non-preemptive.

03
Round
Easy
Video Call
Duration75 Minutes
Interview date30 Jun 2022
Coding problem4

there were 2 interviewers.

1. DBMS Questions

what are joins and it's different types. what is cross join?
write a query to find the nth highest salary.

2. OS Questions

what is internal fragmentation, external fragmentation, defragmentation.
cpu scheduling algorithms?

3. Preorder Traversal

Easy
15m average time
85% success
0/40
Asked in companies
Morgan StanleyWalmartMicrosoft

You are given the root node of a binary tree consisting of ‘N’ nodes. Your task is to return its preorder traversal. The preorder traversal of a binary tree is defined as a process of traversing each node in the following manner-:

1- Visit the root node.
2- Traverse all nodes in the left subtree of the root node.
3- Traverse all the nodes in the right subtree of the root node.
For Example:
For the given tree below,
Preorder traversal for the given tree will be [1, 2, 4, 5, 3]. Hence, the answer is [1, 2, 4, 5, 3].

Example

Example:
Elements are in the level order form. The input consists of values of nodes separated by a single space in a single line. In case a node is null, we take -1 in its place.

For example, the input for the tree depicted in the below image would be :

Example

1
2 3
4 -1 5 6
-1 7 -1 -1 -1 -1
-1 -1

Explanation :
Level 1 :
The root node of the tree is 1

Level 2 :
Left child of 1 = 2
Right child of 1 = 3

Level 3 :
Left child of 2 = 4
Right child of 2 = null (-1)
Left child of 3 = 5
Right child of 3 = 6

Level 4 :
Left child of 4 = null (-1)
Right child of 4 = 7
Left child of 5 = null (-1)
Right child of 5 = null (-1)
Left child of 6 = null (-1)
Right child of 6 = null (-1)

Level 5 :
Left child of 7 = null (-1)
Right child of 7 = null (-1)

The first not-null node (of the previous level) is treated as the parent of the first two nodes of the current level. 

The second not-null node (of the previous level) is treated as the parent node for the next two nodes of the current level and so on.

The input ends when all nodes at the last level are null (-1).
Note :
The above format was just to provide clarity on how the input is formed for a given tree. 

The sequence will be put together in a single line separated by a single space. Hence, for the above-depicted tree, the input will be given as:

1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1
Try solving now

4. Largest Element in the Array

Easy
10m average time
90% success
0/40
Asked in companies
CognizantMakeMyTripMorgan Stanley

Given an array ‘arr’ of size ‘n’ find the largest element in the array.


Example:

Input: 'n' = 5, 'arr' = [1, 2, 3, 4, 5]

Output: 5

Explanation: From the array {1, 2, 3, 4, 5}, the largest element is 5.
Try solving now
04
Round
Medium
Video Call
Duration60 Minutes
Interview date1 Jul 2022
Coding problem2

It was a behavioral round.

1. Basic HR Questions

standard behavioral questions like
why morgan stanley?
5 principles of morgan stanley?
how to resolve conflict in a team?
my internship experience?

2. System Design Question

1 low level design question to design a parking lot.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which SQL keyword removes duplicate records from a result set?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Morgan Stanley
0 views
0 comments
0 upvotes
company logo
Software Engineer
2 rounds | 6 problems
Interviewed by Morgan Stanley
708 views
0 comments
0 upvotes
company logo
Technology Analyst
2 rounds | 6 problems
Interviewed by Morgan Stanley
714 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Morgan Stanley
577 views
0 comments
0 upvotes