InterviewLegend

Sorting, Pairs and Intervals

Alex Chen30 min readUpdated 108 real interview reports

Barclays OAs have included all three, each a familiar problem under a business story. One is a pair search, one merges neighbouring entries, and one is about intervals.

None of them needs more than a sort and one linear pass. The marks depend on the rules in the wording, such as how a tie breaks, whether the output is a list or a count, and whether a stretch covered twice counts twice.

The Barclays angle
Expect the brute force to pass the samples. A double loop over pairs clears the small cases in the statement, and so does a sum that ignores overlaps when the sample has none. The hidden cases are bigger and messier, and that's where the shortcut fails on time or on the count. You can keep the brute force as a checker, but submit the sorted version.

BarclaysPremium lesson · Coding round

The 3 Barclays problems are below.

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

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

Get the Barclays questions

$49 a year · all 100 companies · cancel anytime

From 108 Barclays reports, forum threads behind logins and write-ups in Chinese.

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

Know what Barclays asks before you walk in.

30 coding · 1 system design · 28 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.