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

SDE - Intern

JP Morgan
upvote
share-icon
1 rounds | 2 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 2 Months
Topics: Data Structures, Pointers, Linked List, Trees, Graphs, Dynamic Programming, Back Tracking, React JS.
Tip
Tip

Tip 1 : Practise leetcode questions as much as possible.
Tip 2 : Try to come up with Optimised solution always. 
Tip 3 : Try using c++ for the online assessments.

Application process
Where: Other
Eligibility: No standing arrears.
Resume Tip
Resume tip

Tip 1 : Keep it to one side
Tip 2 : Only add the things necessary for the role that you're applying for.
Tip 3 : Don't lie in the resume and add projects related to the role.
Tip 4 : Add any volunteering work that you did.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 Minutes
Interview date24 Sep 2022
Coding problem2

It was an online assessment. I was given 2 coding questions was supposed to complete it in 90 Minutes.

1. City of Happy People

Moderate
20m average time
80% success
0/80
Asked in companies
JP MorganNXP SemiconductorsShell india

Ninja is traveling to a Happy city where ‘N’ people reside. In the city, the happiness of each person is represented as a number ‘H’ where ‘H’ ranges from -20,000,000 to 20,000,000 (both inclusive). The happiness of each person in the city is given in an array/list ‘HAPPINESS’ where ‘HAPPINESS[i]’ represents the happiness of the i’th person.

Ninja wants to make a group of people such that the overall happiness of the group (sum of happiness value of all the people in the group) ranges between ‘A’ and ‘B’ where -500,000,000 ≤ A ≤ B ≤ 500,000,000. Ninja wants to know in how many ways he can make this group.

For example :
For the given ‘HAPPINESS[]’ = ‘[-1, 0, 3]’ and ‘A’ = 0 , ‘B’ = 2. Following are the ways to group people such that the overall happiness of the group is between ‘A’ and ‘B’:

[-1, 0, 3], the sum of all the happiness values of this group is 2.

[-1, 3], the sum of all the happiness values of this group is 2.

[0], the sum of all the happiness values of this group is 0.

[ ], the sum of all the happiness values of this empty group is 0.

So the number of ways is 4.

As Ninja is busy with some other task so he asks you for help. Can you help Ninja to find out the number of ways in which he can pick groups so that the overall happiness of the group must be in the range between ‘A’ and ‘B’?

Try solving now

2. Valid Parentheses

Easy
10m average time
80% success
0/40
Asked in companies
OracleSwiggyAmerican Express

You're given a string 'S' consisting of "{", "}", "(", ")", "[" and "]" .


Return true if the given string 'S' is balanced, else return false.


For example:
'S' = "{}()".

There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
Problem approach

This solution utilizes a stack data structure; the C++ STL stack is used instead of implementing one from scratch.

The stack is templated with the char datatype because individual characters from the string s will be pushed on top of it as we iterate through s.

ch is assigned the pointer to the string s using the std::string::data() method. This will serve as the starting point of the while-loop, which will run as long as there as a character at the pointer.

The gist of the while-loop involves first checking if the current character is one of the left parantheses ('(', '{', or '['), or one of the right parentheses (')', '}', or ']'). If it is the former, simply push it onto the top of the stack using the std::stack::push() method. If it is the latter, check the top of the stack to see if there is a corresponding left parenthesis using the std::stack::top() method. If there is a matching left parenthesis, remove the top character from the stack using the std::stack::pop() method. However, if the top character of the stack does not match the current ch character, return false. At the end of each iteration, increment the ch pointer by 1 to move it to the next character in s.

After the while-loop, if the stack is not empty, it means that there are left parentheses that were not matched with their corresponding right parenthesis. Therefore, check whether the stack is empty using the std::stack::empty() method, and return false if the stack is not empty.

If the code has not returned false at this point, we can safely conclude that the string of parentheses is valid. Therefore, return true.

Try solving now

Here's your problem of the day

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

Skill covered: Programming

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 5 problems
Interviewed by JP Morgan
1279 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 5 problems
Interviewed by JP Morgan
0 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by JP Morgan
1024 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by JP Morgan
1016 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15447 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15307 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10120 views
2 comments
0 upvotes