InterviewLegend

Two Pointers & Sliding Windows

Alex Chen20 min readUpdated 183 real interview reports

Two pointers and sliding windows are the second-largest slice of the JPMorgan coding round, just behind arrays and hashing in the candidate reports. Both patterns rest on the same idea. You make one pass over an array or a string, carry a little running state, and let two indices traverse it. A problem that looks like a nested loop becomes a single linear sweep.

The problems in this family are the everyday medium tier the bank favors, well short of a hard-puzzle gauntlet. A Premium question is the one that recurs most here, reported "with a twist," and the substring and rolling-window questions ride alongside it. Learn three skeletons cold, converging pointers, a window that grows and shrinks, and a fixed window backed by a deque, and most of what JPMorgan asks in this band falls out of them.

JPMorganPremium lesson · Coding round

The 3 JPMorgan problems are below.

  1. A Premium questionCoding · Medium · Frequently asked
  2. A Premium questionCoding · Hard
  3. A Premium questionCoding · Hard

Each with hints, the follow-up and a tested solution.

Get the JPMorgan questions

$49 a year · all 100 companies · cancel anytime

From 183 JPMorgan reports, forum threads behind logins and write-ups in Chinese.

Had your JPMorgan interview?Tell us what they asked. Reviewed before it goes in, never with your name.
JPMorgan interview guide

Know what JPMorgan asks before you walk in.

15 coding · 3 system design · 18 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.