Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Morgan Stanley interview experience Real time questions & tips from candidates to crack your interview

# Digital Technology Intern

Morgan Stanley
3 rounds | 7 Coding problems

## Interview preparation journey

Preparation
Duration: 6 months
Topics: Data Structures,Algorithms,Operating System,DBMS,OOPS concept,Low Level Design
Tip

Tip 1 : Practice all the data structures thoroughly and know about the basic concepts behind them and their use cases in real world.
Tip 2 : Be thorough with your resume .
Tip 3 : Be confident while answering the questions and be honest about your work.

Application process
Where: Campus
Eligibility: 7.5 CGPA and above
Resume tip

Tip 1 : Keep your resume crisp and to the point.
Tip 2 : Have a thorough understanding of the technologies used in the project and why was that specific technology chosen.

## Interview rounds

01
Round
Medium
Online Coding Interview
Duration120 minutes
Interview date1 Sep 2020
Coding problem2

There were three sections in the online test:-
1)First section consisted of Aptitude MCQ questions .
2)Second section was the debugging part which required to debug a piece of code.
3)Third section had 3 programming questions.

### 1. Count Inversions

Moderate
40m average time
55% success
0/80

#### An inversion is defined for a pair of integers in the array/list when the following two conditions are met.

``````A pair ('ARR[i]', 'ARR[j]') is said to be an inversion when:

1. 'ARR[i] > 'ARR[j]'
2. 'i' < 'j'

Where 'i' and 'j' denote the indices ranging from [0, 'N').
``````

### 2. Count Ways To Reach The N-th Stairs

Moderate
30m average time
80% success
0/80

#### You are supposed to return the number of distinct ways you can climb from the 0th step to the Nth step.

##### Example :
``````N=3
``````

``````We can climb one step at a time i.e. {(0, 1) ,(1, 2),(2,3)} or we can climb the first two-step and then one step i.e. {(0,2),(1, 3)} or we can climb first one step and then two step i.e. {(0,1), (1,3)}.
``````
02
Round
Medium
Video Call
Duration60 minutes
Interview date3 Sep 2020
Coding problem4

This round started with my introduction and a brief discussion on the technologies I used in my project. After this, the interviewer asked me 3 coding questions and one low-level design question.

### 1. Second largest element in the array

Easy
15m average time
80% success
0/40

#### You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

##### Note:
``````a) Duplicate elements may be present.

b) If no such element is present return -1.
``````
##### Example:
``````Input: Given a sequence of five numbers 2, 4, 5, 6, 8.

Output:  6

Explanation:
In the given sequence of numbers, number 8 is the largest element, followed by number 6 which is the second-largest element. Hence we return number 6 which is the second-largest element in the sequence.
``````
Problem approach

I traversed the array twice. In the first traversal, I found the maximum element. In the second traversal I found the greatest element less than the element obtained in the first traversal.

### 2. Minimum Number of Platforms

Moderate
30m average time
70% success
0/80

#### Your task is to find the minimum number of platforms required for the railway station so that no train needs to wait.

##### Note :
``````1. Every train will depart on the same day and the departure time will always be greater than the arrival time. For example, A train with arrival time 2240 and departure time 1930 is not possible.

2. Time will be given in 24H format and colons will be omitted for convenience. For example, 9:05AM will be given as "905", or 9:10PM will be given as "2110".

3. Also, there will be no leading zeroes in the given times. For example, 12:10AM will be given as “10” and not as “0010”.
``````
Problem approach

I took a variable to count the number of platforms required at a particular time and a final ans variable. I took 2 arrays one for arrival time and the other for departure time and sorted both the arrays. Then I took 2 pointers at the start of each array and compared the timings pointed by the 2 variables. If the smallest time was of arrival I incremented my count variable otherwise decremented it and incremented the pointer of the smallest time. Every time I changed the count variable I compared it with my final ans variable, if its value is greater than my answer I updated my answer, and finally returned my answer variable.

### 3. Boundary Traversal

Hard
20m average time
85% success
0/120

#### Figure out the boundary nodes of this binary tree in an Anti-Clockwise direction starting from the root node.

##### Example :
``````Input: Consider the binary tree A as shown in the figure:
``````

``````Output: [10, 5, 3, 7, 18, 25, 20]

Explanation: As shown in the figure

The nodes on the left boundary are [10, 5, 3]

The nodes on the right boundary are [10, 20, 25]

The leaf nodes are [3, 7, 18, 25].

Please note that nodes 3 and 25 appear in two places but are considered once.
``````
Problem approach

First I printed the left-most boundary of the tree, then I printed all the leafs of the tree, and then the rightmost boundary in reverse order using recursion.

### 4. System Design

I was asked to design a parking lot in which there were 3 vehicles of small, medium, and large size. There were 3 types of slots for the vehicles small, medium, and large size. The small-sized vehicle can be parked in any of the 3 types of lots, medium-sized vehicles can be parked in only medium and large-sized lot and the large vehicles can be parked in a large-sized lot only. I had to design an efficient way to park the vehicles.

Problem approach

I created 3 maps for small, medium, and large-sized parking lots and classes for the vehicles and the parking lots using OOPS concepts. I created a function that took a vehicle for parking and looked for the smallest parking lot in which it can fit, if the smaller parking lot was not available I looked for the bigger ones and so on.

03
Round
Medium
HR Round
Duration45 minutes
Interview date5 Sep 2020
Coding problem1

This Round was a Technical + HR round which consisted of one coding question and some general HR Questions like what are your strengths and weeknesses and why do you want to join Morgan Stanley.

### 1. Next Greater Number

Moderate
15m average time
90% success
0/80

#### You are given a string S which represents a number. You have to find the smallest number strictly greater than the given number which contains the same set of digits as of the original number i.e the frequency of each digit from 0 to 9 should be exactly the same as in the original number.

##### For example:
``````If the given string is 56789, then the next greater number is 56798. Note that although 56790 is also greater than the given number it contains 1 '0' which is not in the original number and also it does not contain the digit '8'.
``````

#### Note:

``````The given string is non-empty.

If the answer does not exist, then return -1.

The given number does not contain any leading zeros.
``````

Here's your problem of the day

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

What does ROLLBACK do in DBMS?

Start a Discussion
Similar interview experiences
SDE - 1
2 rounds | 4 problems
Interviewed by Morgan Stanley
0 views
Software Engineer
2 rounds | 6 problems
Interviewed by Morgan Stanley
579 views
Technology Analyst
2 rounds | 6 problems
Interviewed by Morgan Stanley
608 views