Implement Interview Coding Problems
AmazonSoftware Engineer · Technical ScreenLast updated
This question evaluates implementation and algorithmic skills across core data structures and array/interval algorithms, specifically hashing (hash map design including collision handling and resizing), interval merging and intersection logic, and array optimization problems such as maximum container area and trapped rainwater.
Solve the following independent coding tasks from a new-grad software engineering interview.
- Implement a hash map from scratch.
- Support integer keys and integer values.
- Implement
put(key, value),get(key), andremove(key). get(key)should return the stored value if the key exists; otherwise return-1.- Do not use built-in hash table, dictionary, map, set, or collection libraries. You may use primitive arrays and your own node/classes.
- Handle collisions correctly and explain how your design could resize when the load factor becomes too high.
- Solve interval problems.
- Part A: Given an unsorted list of closed intervals
[start, end], merge all overlapping intervals and return a sorted list of non-overlapping intervals. - Part B follow-up: Given two lists of pairwise-disjoint, sorted closed intervals, return all intersections between intervals from the two lists.
- Solve water-container array problems.
- Part A: Given an array of non-negative integers where each value represents the height of a vertical line at that index, choose two lines that, together with the x-axis, form a container holding the maximum possible area of water. Return that maximum area.
- Part B follow-up: Given an array of non-negative integers representing an elevation map, compute how much rain water can be trapped after raining.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.