amazon logo
Amazon· SDE II

Amazon OA | SDE2 Interview Questions

Posted
17 Oct 2024
318 reads

Summary

I recently encountered a challenging online assessment for an SDE2 role at Amazon, which featured a unique problem involving array manipulation and prefix sums.

How it went

During my Amazon OA for the SDE2 position, I was presented with a problem that required careful thought about array transformations while maintaining specific conditions. The question involved deciding which elements to negate to maximize the count of negative elements, all while ensuring every prefix sum remained positive. I found the problem statement clear, and the provided example helped in understanding the constraints and expected output. It was an interesting problem that tested my greedy approach and understanding of array properties.

Questions asked (1)

  1. 01

    Maximize Negative Elements with Positive Prefix Sums

    Data Structures & Algorithms

    Given an array of N positive integers. You can make any number of elements in it negative such that every prefix sum of the array remains positive i.e >0. Find the maximum number of elements you can make negative.

    Example:
    Input: 5 2 3 5 2 3
    Output: 3
    Explanation: This can be converted to 5 -2 3 5 -2 -3

    Constraints:
    N is 10^5
    Ai <= 10^9

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!