amazon logo
Amazon· sde 1

Amazon OA Coding Questions 2025

Result
null
Location
null
Posted
21 Aug 2025
876 reads

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)

  1. 01

    Minimum Cost to Convert Products

    Data Structures & Algorithms · Hard

    You are given an array product[] of size n, where each element is 0 or 1.

    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 to 0.
    The cost of an operation = sum of values in that subarray before conversion.

    Return the minimum cost to make the entire array all 0.

  2. 02

    Minimize Inconvenience of Delivery Centers

    Data Structures & Algorithms · Hard

    A city is represented as a grid:

    Delivery centers are marked as 1
    All other places are marked as 0

    The distance between two cells is defined as d((x1,y1), (x2,y2)) = max(|x1-x2|, |y1-y2|).

    The inconvenience of the grid is the maximum distance of any 0 from its nearest delivery center.

    Amazon is planning to open one new delivery center. You may flip at most one 0 to 1.
    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.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Amazon recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!