
Here are two recent Amazon OA problems to practice.
Problem 1: Reduce Gifts
Given an array of item prices, find the minimum number of items to remove so that no group of k
items has a total price exceeding a given threshold. If the array has fewer than k
items, no removal is needed.
Approach.
- Sort prices descending.
- Check the sum of the top
k
prices; if it exceeds the threshold, remove the highest-priced items one by one until it no longer does.
Problem 2: Cloud Queue Expiration
AWS processes customer requests in a FIFO queue. Each request is processed in a FIFO queue. i
has a maximum wait time wait[i]
. If not served within that many seconds, it expires and is removed. Every second, the server handles the front request, and then removes any expired ones.
Approach.
- Simulate time from 0 upward.
- Keep a queue of requests with their expiration times.
- At each second, serve the front request if still valid; then dequeue any expired requests.
- Count how many are successfully served before expiring.
Through our interview assistance and Amazon OA ghostwriting services, candidates demonstrate both coding skill and clear problem- solving communication. Ready for your next OA? Contact us now!