JPMorgan Coding Interview Questions
25 JPMorgan coding interview problems with full optimal solutions — 14 easy, 10 medium, 1 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an JPMorgan interviewer values, and a FAQ section.
Showing 14 problems of 25
- #1easyfoundational
1. Two Sum
Two Sum is the canonical JPMorgan SDE phone-screen warm-up: given an integer array and a target, return the indices of the two numbers that add up to the target. JPMorgan interviewers grade your willingness to narrate the brute-force-to-optimal tradeoff before writing the hash-map version.
3 free resourcesSolve → - #13easyfrequently asked
13. Roman to Integer
Convert a Roman-numeral string to its integer value. JPMorgan asks this on Software Engineer Programme phone screens because the subtraction rule (IV = 4, IX = 9) makes it the smallest interesting case-by-case parser — a clean check on careful conditional handling.
3 free resourcesSolve → - #14easyfrequently asked
14. Longest Common Prefix
Given an array of strings, return the longest common prefix shared by all of them. JPMorgan asks this on Software Engineer Programme phone screens as a string-processing warm-up that doubles as a check on edge-case handling (empty list, single-string list, no common prefix).
3 free resourcesSolve → - #20easyfoundational
20. Valid Parentheses
Given a string of brackets, decide whether every opener is matched by the correct closer in the right order. JPMorgan asks this as a phone-screen warm-up on the Software Engineer Programme because it is the smallest interesting use of an explicit stack and the easiest place to grade off-by-one mistakes.
3 free resourcesSolve → - #21easyfrequently asked
21. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list. JPMorgan asks this on Software Engineer Programme phone screens because it tests pointer manipulation cleanly and sets up natural follow-ups (merge k lists, merge sorted arrays).
3 free resourcesSolve → - #35easyfrequently asked
35. Search Insert Position
Given a sorted array and a target, return the index where target is found, or the index at which it would be inserted. JPMorgan asks this on Software Engineer Programme phone screens to verify clean binary-search bounds reasoning before moving to harder follow-ups.
3 free resourcesSolve → - #66easyfrequently asked
66. Plus One
Increment by one a non-negative integer represented as a digit array. JPMorgan asks this on Software Engineer Programme phone screens as a low-cognitive-load problem that grades carry-propagation correctness and edge-case handling on a leading 9.
3 free resourcesSolve → - #70easyfrequently asked
70. Climbing Stairs
Count the distinct ways to climb n stairs, taking 1 or 2 steps at a time. JPMorgan asks this on Software Engineer Programme phone screens as the simplest dynamic-programming problem — your willingness to recognise the Fibonacci recurrence is the grading signal.
3 free resourcesSolve → - #121easycompany favorite
121. Best Time to Buy and Sell Stock
Given a day-indexed price array, find the maximum profit from one buy and one later sell. JPMorgan asks this on nearly every market-data and equities-tech SDE loop because the optimal single-pass min-tracking solution generalises directly to streaming P&L computation.
3 free resourcesSolve → - #136easyfrequently asked
136. Single Number
Find the one integer that appears once in an array where every other element appears twice. JPMorgan asks this on Software Engineer Programme phone screens to test whether you reach for the XOR trick or default to a hash set — the bit-level insight is the grading signal.
3 free resourcesSolve → - #206easyfrequently asked
206. Reverse Linked List
Reverse a singly linked list. JPMorgan asks this on Software Engineer Programme phone screens to verify you can manipulate pointers safely without losing the next reference — a foundational signal before any harder linked-list follow-up.
3 free resourcesSolve → - #283easyfrequently asked
283. Move Zeroes
In-place move every zero to the end of an array while keeping non-zero values in their original order. JPMorgan asks this as a Software Engineer Programme phone-screen warm-up to see whether you reach for two-pointer over-write before allocating a new array.
3 free resourcesSolve → - #387easyfrequently asked
387. First Unique Character in a String
Return the index of the first non-repeating character in a string. JPMorgan asks this on Software Engineer Programme phone screens as a frequency-map warm-up that primes for the streaming follow-up: 'now imagine characters arrive one at a time'.
3 free resourcesSolve → - #509easyfoundational
509. Fibonacci Number
Compute the n-th Fibonacci number where F(0)=0, F(1)=1, F(n)=F(n-1)+F(n-2). JPMorgan asks this on early-career and intern phone screens to test whether you can recognise the recurrence and pivot from naive recursion to O(n) iteration in under a minute.
3 free resourcesSolve →