I recently completed the J.P. Morgan Online Assessment on the HackerRank platform. Overall, the J.P. Morgan OA Questions were not particularly difficult. I finished both coding problems in around 10 minutes and passed every test case on my first submission, leaving plenty of time to review my code, verify edge cases, and make small optimizations.
The assessment mainly evaluates fundamental algorithm knowledge, implementation skills, and the ability to write clean, reliable code. Although there are only a couple of questions, solving them quickly requires a solid understanding of common algorithmic patterns and careful handling of boundary conditions. The problems also felt fairly practical and reflected the engineering mindset often expected in financial technology companies.
Below is a breakdown of the two coding questions, along with the approaches I used and some preparation tips for anyone getting ready for J.P. Morgan or similar investment banking and fintech coding assessments.
J.P. Morgan OA Questions Breakdown
Question 1: Minimum Cores Required
Problem Description
Given n processes, each process has a start time start[i] and an end time end[i] (inclusive). A CPU core can execute only one process at any given time. Determine the minimum number of CPU cores required to execute all processes without conflicts.
Example:
n = 3 start = [1, 3, 4] end = [3, 5, 6] Answer: 2
Solution Idea
This is a classic interval overlap problem. I solved it using the Sweep Line algorithm. The idea is to convert every start time and end time into timeline events, sort them, and scan from left to right.
Whenever a process starts, increment the active process count. Whenever a process ends, decrement the count. Since the problem specifies that end times are inclusive, if both a start event and an end event occur at the same timestamp, the start event must be processed first before the end event.
During the scan, the maximum number of simultaneously running processes is exactly the minimum number of CPU cores required.
The algorithm runs in O(n log n) time because of sorting and is both simple and efficient. It's also one of the most frequently tested interval-processing techniques on HackerRank.
My Thoughts
Although this is a standard interval problem, the event ordering at identical timestamps is the key detail. Missing that small condition can easily produce an incorrect answer. I added comments while coding to remind myself about the inclusive endpoint requirement, and all test cases passed smoothly.
Question 2: Array Challenge
Problem Description
Given an integer array arr, compute a counter for every element.
For each previous element on its left:
- If the previous element is larger, subtract the absolute difference.
- If the previous element is smaller, add the absolute difference.
Return the resulting counter value for every position.
Example:
arr = [2, 4, 3] Output: [0, 2, 0]
Solution Idea
I implemented the straightforward double-loop simulation. For every element, iterate through all previous elements and update the counter according to the given rules.
Although the worst-case complexity is O(n²), the actual HackerRank test data was completely manageable, and the simple implementation passed every test case without any performance issues.
The first element naturally has no previous elements, so its counter is always zero. After finishing the implementation, I manually verified several sample cases to ensure the signs and indexing were handled correctly.
My Thoughts
This problem looks easy at first glance, but it's surprisingly easy to introduce sign mistakes or indexing bugs. Writing the solution carefully and checking edge cases was more important than trying to over-optimize the implementation.
Overall Experience and Preparation Tips
Overall, the J.P. Morgan OA Questions were of moderate difficulty. The first question focused on interval processing and sorting, while the second emphasized careful simulation and implementation. Candidates who are familiar with common HackerRank patterns should find the assessment very manageable.
Here are a few preparation suggestions:
- Master the Sweep Line algorithm for interval overlap problems.
- Practice simulation problems and pay close attention to edge cases.
- Become familiar with HackerRank's input/output format before the assessment.
- Solve as many previous OA questions as possible since similar patterns appear frequently.
- Focus on writing clean, readable, and maintainable code instead of only chasing the shortest solution.
Besides coding ability, J.P. Morgan also values engineering quality and code readability. Organizing your solution clearly and explaining your thought process can be just as important as producing the correct answer.
Need Extra Help Preparing?
If you're preparing for J.P. Morgan, Goldman Sachs, Morgan Stanley, or other fintech and investment banking interviews, having access to experienced guidance can significantly improve your preparation efficiency. Interview Aid offers comprehensive interview support, including OA preparation, technical interview coaching, mock interviews, and strategy guidance from experienced software engineers who understand the recruiting process at top technology and finance companies.
Top comments (0)