InterviewLegend

Splitting and Merging Arrays

Alex Chen30 min readUpdated 33 real interview reports

These three online assessment tasks each hide a pair search. Trying every pair runs out of time on the hidden tests, so each problem below comes with a short reason why one pass or one heap is enough.

A running minimum, a prefix sum and a min-heap carry the three solutions. Each one turns a quadratic search into a single sweep or a short run of heap pops.

The American Express angle
Amex leans on Java, and two of these overflow an int. Values in the statements reach 10^9, so two of them added together already pass the 32-bit range. Keep sums and heap entries as long from the first line. Write the brute force first and run it on the samples, then make the faster version agree with it before you submit.

American ExpressPremium lesson · Coding round

The 3 American Express problems are below.

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

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

Get the American Express questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

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

Know what American Express asks before you walk in.

30 coding · 3 system design · 15 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.