Hash Maps and Arrays
Arrays and hashing make up the middle of Fidelity's coding rounds. The problems are short, and most need one pass with one map or set. What changes from problem to problem is which collection you pick, and Fidelity reviewers will ask about it. Candidates have been asked to justify something as small as getOrDefault, and a LinkedHashSet or a switch can get the same question, so have a reason ready for each choice.
Order matters more than people expect. A plain HashMap or HashSet iterates in no fixed order, but results usually come back in the order they were found, and the linked versions keep that order. Other problems turn on a different small choice, like how to treat two equal values in a row. Make that choice first and the rest of the code stays short.
All four problems below run in one pass at O(n) time. Sorting also works for two of them at O(n log n), but it loses the input order, so mention it as the option for when memory is tight. Write the plain loop first, and offer a Streams version with Collectors.groupingBy if the panel wants it.
FidelityPremium lesson · Coding round
The 4 Fidelity problems are below.
- A Premium questionCoding · Easy
- A Premium questionCoding · Medium
- A Premium questionCoding · Easy
+ 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.
Fidelity interview guideKnow what Fidelity asks before you walk in.
29 coding · 1 system design · 15 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.