InterviewLegend

Searching, Sorting and Paths

Alex Chen40 min readUpdated 55 real interview reports

Fidelity likes classic algorithms written from memory: bubble sort, merge sort, quicksort or binary search, followed by a line-by-line walkthrough. Bubble sort has come up in both US intern rounds and India rounds. Write your version by hand first, and mention Arrays.sort only after it works.

The India campus test also has a short written section where you describe an algorithm in pseudocode and the code never runs. An all-pairs path algorithm has come up there, and so has a problem solved by binary search on the answer. Both are hard to work out under a timer, so learn the loop order and the check ahead of time.

Integer overflow is the bug that shows up most across these problems. (lo + hi) / 2 can wrap negative on large indexes, adding two infinite costs in a path table wraps the same way, and a running load can pass two billion. If you're asked which sort to write, merge sort is the safest pick because it runs in O(n log n) on every input and it's stable. Quicksort works too if you can explain its worst case.

FidelityPremium lesson · Coding round

The 4 Fidelity problems are below.

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

+ 1 more in this lesson

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

Get the Fidelity 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 Fidelity interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Fidelity interview guide

Know what Fidelity asks before you walk in.

29 coding · 1 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.