Open In App

Morgan Stanley Interview Experience

Last Updated : 21 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

01 Round – Medium – Online Coding Round

Duration: 180 minutes

Problems: 3

Problem 1: Non-Decreasing Array

Given an integer array/list ‘ARR’ of size ‘N’, write a solution to check if it can become non-decreasing by modifying at most 1 element.

Input Format:

The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first line contains an integer 'N' denoting the size of the array/list.
The second line contains 'N' space-separated integers denoting the array/list.
Output Format:

For each test case, print "true" if it's possible to make 'ARR' a non-decreasing array with modifying at most one element, or "false" otherwise.
Constraints:

1 <= T <= 50
1 <= N <= 10^4
-10^9 <= ARR[i] <= 10^9
Problem Approach:
Determine whether the array can be made non-decreasing by modifying at most one element.

Problem 2: Minimum Stops Required To Reach The Destination

Given an integer array ‘AIRPORTS’ of size ‘N’ representing airport information along the x-axis, find the minimum number of stops a plane must take to reach the destination (X, 0), considering a plane that can cover at most ‘K’ units in one flight.

Input Format:

The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first line contains three space-separated integers: 'N', 'K', and 'X'.
The second line contains 'N' space-separated integers representing the airport information.
Output Format:

For each test case, print the minimum number of stops needed to reach the destination (X, 0) on the x-axis, or -1 if unreachable.
Constraints:

1 <= T <= 10
1 <= N <= 5000
1 <= K < N
1 <= X < N
0 <= AIRPORTS[i] <= 1
Problem Approach:
Solve using a dynamic programming approach to find the minimum stops required.

Problem 3: Longest Balanced Substring

Given a string ‘STR’ containing only ‘(‘ and ‘)’, find the length of the longest balanced substring.

Input Format:

The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first and only line contains a string 'STR' containing '(' and ')' characters.
Output Format:

For each test case, print the length of the longest balanced substring.
Constraints:

1 <= T <= 10
1 <= |STR| <= 5 * 10^4
Problem Approach:
Use a monotonic Stack approach to find the longest balanced substring.

02 Round – Medium – Technical Interview

Duration: 90 minutes

Problems: 3

Problem 1: Largest Tree Value

Given the ‘ROOT’ of a binary tree with ‘N’ nodes, find the largest value in each row or level of the binary tree.

Input Format:

The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first line contains elements of the tree in level order form.
The line consists of values of nodes separated by a single space.
Output Format:

For each test case, print the maximum value at each row of the binary tree.
Constraints:

1 <= T <= 50
0 <= N <= 10^3
1 <= DATA <= 10^4
Problem Approach:
Traverse the binary tree in pre-order, keeping track of the level and updating the maximum value for each level.

Problem 2: Jump Game

Given an array ‘JUMP’ of size ‘N’, determine if you can reach index ‘N’ (end) starting from index 1, considering the maximum jump allowed at each index.

Input Format:

The first line contains an integer 'N' denoting the length of the array 'JUMP'.
The second line contains 'N' integers denoting values of 'JUMP'.
Output Format:

Print "YES" if you can reach the end, otherwise "NO".
Problem Approach:
Backtrack from the last element to determine if you can reach the first element.

Problem 3: Flip Game II

Given a string ‘STR’ containing ‘$’ and ‘*’, determine if Ninja can win the flip game.

Input Format:

The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first and only line contains an input string 'STR'.
Output Format:
For each test case, print "true" if Ninja wins the flip game, otherwise "false".
Constraints:

1 <= T <= 100
1 <= |STR| <= 20
'STR[i]' = {'*', '$'}

03 Round – Easy – HR Round

Duration: 60 minutes

Problem: Basic HR Questions

  • Introduce yourself.
  • Discuss your strengths and weaknesses.
  • Describe your approach to overcoming weaknesses.

These are the details of the interview rounds and the problems presented during each round.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads