Skip to main content

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 10 problems of 25

  • #2mediumfrequently asked

    2. Add Two Numbers

    Add two non-negative integers stored as singly linked lists in reverse-digit order. JPMorgan asks this on SDE onsites as the linked-list version of the carry-propagation pattern — they specifically grade whether you can fold three loops (both lists, leftover digits, final carry) into one clean loop.

    3 free resourcesSolve →
  • #11mediumfrequently asked

    11. Container With Most Water

    Given heights of vertical lines, find the two that form the rectangle with the largest water volume. JPMorgan asks this on SDE onsites because the two-pointer move-the-shorter-side argument is the canonical place to grade your invariant-narration skill.

    3 free resourcesSolve →
  • #15mediumfrequently asked

    15. 3Sum

    Find all unique triplets (a, b, c) in an integer array such that a + b + c = 0. JPMorgan asks this on SDE onsites as the natural Two-Sum follow-up — the grading signal is correct duplicate handling on both the outer fix-one loop and the inner two-pointer walk.

    3 free resourcesSolve →
  • #49mediumfrequently asked

    49. Group Anagrams

    Group an array of strings such that strings that are anagrams of one another sit together. JPMorgan asks this on SDE onsites to test whether you choose the right canonical key (sorted string vs character-count tuple) and reason about the tradeoffs.

    3 free resourcesSolve →
  • #53mediumcompany favorite

    53. Maximum Subarray

    Find the contiguous subarray with the largest sum. JPMorgan asks this on quant-research and equities-tech loops because the optimal Kadane's algorithm is one line of state and maps directly to 'largest cumulative P&L window' on a returns series.

    3 free resourcesSolve →
  • #54mediumfrequently asked

    54. Spiral Matrix

    Return all elements of a matrix in spiral order. JPMorgan asks this on SDE onsites to test whether you can manage four moving boundaries (top, bottom, left, right) without falling into the off-by-one trap that hits 80% of candidates.

    3 free resourcesSolve →
  • #122mediumfrequently asked

    122. Best Time to Buy and Sell Stock II

    Same setup as LC 121, but you may buy and sell as many times as you like (no more than one stock at a time). JPMorgan asks this as the natural follow-up on equities and markets-tech loops to test whether you can spot the 'sum every positive day-over-day delta' insight.

    3 free resourcesSolve →
  • #238mediumfrequently asked

    238. Product of Array Except Self

    For each index, compute the product of all other elements without using division and in O(n) time. JPMorgan asks this on SDE onsites because the optimal prefix-and-suffix-product solution is the smallest interesting use of the 'two passes with O(1) extra space beyond the output' pattern.

    3 free resourcesSolve →
  • #287mediumfrequently asked

    287. Find the Duplicate Number

    Given an array of n+1 integers in the range [1, n], find the one duplicate without modifying the array and in O(1) extra space. JPMorgan asks this on SDE onsites to test whether you spot the linked-list cycle interpretation — the Floyd's tortoise-and-hare answer is the canonical optimal.

    3 free resourcesSolve →
  • #322mediumfrequently asked

    322. Coin Change

    Given coin denominations and a target amount, return the minimum number of coins needed (or -1 if impossible). JPMorgan asks this on SDE onsites because it is the canonical unbounded-knapsack DP — your willingness to articulate the state and transition is the grading axis.

    3 free resourcesSolve →
JPMorgan Coding Interview Questions — Full Solutions — InterviewChamp.AI