Amazon OA Coding Questions 2025
- Result
- null
- Location
- null
- Posted
- 21 Aug 2025
Summary
Interviewed for Amazon SDE 1 role. Faced two challenging coding problems during OA. First problem involved finding minimum cost to convert all products to variant A with specific operations. Second problem required minimizing inconvenience in a grid by strategically placing a new delivery center. Both problems required advanced algorithmic thinking and efficient solution strategies.
How it went
Recently completed Amazon's Online Assessment for the SDE 1 position. The OA consisted of two complex coding problems that tested both algorithmic knowledge and problem-solving skills. The first problem, Minimum Cost to Convert Products, required determining the optimal way to convert all elements in an array to 0 with specific operations, balancing cost and efficiency. The second problem, Minimize Inconvenience of Delivery Centers, involved a grid where the goal was to reduce the maximum distance from any 0 cell to the nearest delivery center by flipping at most one 0 to 1. Both problems demanded a deep understanding of data structures and algorithms, as well as careful planning for optimal solutions.
Questions asked (2)
- 01
Minimum Cost to Convert Products
Data Structures & Algorithms · Hard
You are given an array
product[]of sizen, where each element is0or1.
1= variant B (needs to be converted)
0= variant A (already correct)
Amazon wants to convert all products into variant A (0).
You are allowed to choose a subarray of length =k, and set exactly one element in that subarray to0.
The cost of an operation = sum of values in that subarray before conversion.
Return the minimum cost to make the entire array all0. - 02
Minimize Inconvenience of Delivery Centers
Data Structures & Algorithms · Hard
A city is represented as a grid:
Delivery centers are marked as1
All other places are marked as0
The distance between two cells is defined asd((x1,y1), (x2,y2)) = max(|x1-x2|, |y1-y2|).
The inconvenience of the grid is the maximum distance of any0from its nearest delivery center.
Amazon is planning to open one new delivery center. You may flip at most one0to1.
Find the minimum inconvenience possible after this operation.
How they prepared
Prepared by focusing on algorithmic problem-solving techniques, particularly for dynamic programming and greedy algorithms. Worked on similar problems to understand the optimal approaches for handling large input sizes. Also, practiced multi-source BFS for grid-based problems to tackle the second question effectively.