Amazon OA 2026 interview sharing: summary of amazon oa leetcode questions and solutions

46 Views
No Comment

Recent Amazon OA 2026 has begun to increase its volume, mainly from late January to early February. From the overall experience, this year's OA continues Amazon's usual question-setting style: the questions are new shells, but the underlying model is not unfamiliar. What matters more is whether you can quickly abstract the problem into a standard solution, rather than whether you know a particular trick. There are two questions in this OA. I answered them all in about 15 minutes. While your memory is still clear, let’s briefly organize the questions and ideas to serve as a reference for students preparing for Amazon OA later.

Q1: Longest Same-Speed ​​Segment

Given an array of player speeds, you can delete up to k players and ask what is the length of the "longest continuous segment with the same speed" that can be obtained in the array after deletion. Note that the "continuous segment" here is the result after deletion, which means that the original array can have other speeds sandwiched in the middle, but you can choose to delete them.

Problem-solving ideas

This question is essentially a classic model of "grouping by value + sliding window on subscript". The key lies in observation: what we care about is actually "how long can a certain fixed speed v go?" For the same speed, you only need to record all the subscript positions where it appears in the original array.

The specific method is to first use a hashmap to store all the subscripts corresponding to each speed. Then use a sliding window for the subscript array of each speed, and the window means "select these subscripts as reserved players with the same speed". Inside the window, the number of additional velocities to be deleted can be calculated using the formula: the last index in the window minus the first index plus one, minus the number of elements in the window. If this value does not exceed k, it means that this window is feasible. Maintain the maximum value of the window length, and take the maximum value after traversing all speeds.

Essentially, this question is to find out how long a continuous interval of the same value can be drawn by deleting up to k "impurities" on the subscript axis.

Python reference code

From collections import defaultdict

def longestSameSpeedSegment(speeds, k):
    pos = defaultdict(list)
    for i, v in enumerate(speeds):
        pos[v].append(i)

    ans = 0
    for indices in pos.values():
        left = 0
        for right in range(len(indices)):
            # The number to be deleted
            while indices[right] - indices[left] + 1 - (right - left + 1) > k:
                left += 1
            ans = max(ans, right - left + 1)
    return ans

The time complexity is O(n), which is a very typical Amazon OA accepted solution.

Q2:Special Nodes in Tree

Given a tree, and three specified nodes x, y, z. For each node in the tree, calculate its distance to x, y, z. If these three distances can form a Pythagorean triplet (a² + b² = c²) after sorting, then this node is called a special node. Ask how many special nodes there are in total.

Problem-solving ideas

There are only two points at the core of this question: BFS on the tree is the shortest path, and each node only needs to know its distance to x, y, and z.

The specific method is to start from x, y, and z respectively, perform BFS once each, and obtain three arrays: distX[i], distY[i], and distZ[i], which represent the distance from each node to three specified nodes. Then for each node i, take out these three distances, sort them and judge whether a² + b² = c² is satisfied, and count them if they are satisfied. Because the edge weights of the tree are all 1, what BFS obtains is the shortest path, the overall complexity is O(n), and the space consumption is completely controllable.
The overall complexity is O(n), and the space is completely controllable.

Python reference code

From collections import deque

def bfs(start, graph, n):
    dist = [-1] * n
    q = deque([start])
    dist[start] = 0

    while q:
        u = q.popleft()
        for v in graph[u]:
            if dist[v] == -1:
                dist[v] = dist[u] + 1
                q.append(v)
    return dist

def countSpecialNodes(n, edges, x, y, z):
    graph = [[] for _ in range(n)]
    for u, v in edges:
        graph[u].append(v)
        graph[v].append(u)

    dx = bfs(x, graph, n)
    dy = bfs(y, graph, n)
    dz = bfs(z, graph, n)

    cnt = 0
    for i in range(n):
        d = sorted([dx[i], dy[i], dz[i]])
        if d[0] >= 0 and d[0] * d[0] + d[1] * d[1] == d[2] * d[2]:
            cnt += 1
    return cnt

FAQ|Amazon OA Frequently Asked Questions

How long does it take for Amazon OA to produce results? Do you just hang up when there is no news?
This question is asked almost every round. Actual experience is that Amazon's OA results advancement rhythm is very dependent on batches and headcount. Some candidates will receive the next step within a few days, while others will receive the next step within one to two weeks. If your OA is full AC, but there is no movement in a short period of time, it is more likely a problem of process priority or HC adjustment, which does not necessarily mean that it has been eliminated. One of the more obvious signs is that for candidates who are actually flagged by the system or recruiter to move forward, the process is usually not put on hold indefinitely.

Does OA have to be full AC to have follow-up?
The conclusion would be more realistic. For Amazon, especially New Grad or Early Career batches, the pass probability for full AC is significantly higher. This does not mean that there is no chance if there are less than one or two hidden cases, but judging from a large number of interview feedback, full AC is basically equivalent to the "ticket" to enter Tech Screen or VO. The screening weight of OA on Amazon is indeed very high.

The question is completed, but the code is not elegant enough. Will there be any impact?
In the OA stage, Amazon is more concerned about whether the code is stable, correct, and covering edge cases. As long as the time complexity is within a reasonable range, there are no obvious bugs, and the logic is self-consistent, you will basically not get stuck because you have not written the most elegant or shortest code. OA is more like verifying whether you can write usable and maintainable code under limited time and pressure, rather than showing off skills.

How should I prepare for Amazon OA common questions?
Judging from the question types of recent rounds of OA, the most frequent ones are sliding windows, double pointers, BFS or DFS, HashMap-based modeling, and some DPs whose states are not complex but require abstraction capabilities. Compared with answering questions aimlessly, what is more important is to train yourself to be able to quickly classify the questions into a familiar model within one or two minutes of reading the questions. This is often more critical than the amount of questions.

Without refer, is there still a chance to rely solely on overseas investment and OA?
The answer is yes. Amazon is one of the few companies with a very high OA weight. As long as the resume foundation is not stretched and the OA performance is stable enough, even without a referrer, there is a chance to be directly included in the subsequent process. In many practical cases, the performance of OA determines how far you can go more than refer.

Where is OA most prone to overturning?
The most common situation is not that you don’t know the algorithm, but that you start writing the question before you fully understand it, or you lose track of the complexity and boundary conditions. Such as not taking into account empty inputs, extremely small-scale data, or accidentally writing implicit timeouts in sliding windows and BFS. Amazon's OA doesn't mind if you spend a little more time thinking clearly, but it's very easy to be screened out because of "fast but unstable writing".

About Dachang OA

If you want to avoid pitfalls and improve the pass rate during the OA stage, especially when you need to ensure accuracy when time is limited, having a professional real-time assist plan in advance can really save you a lot of anxiety.Programhelp It supports remote, traceless, and full-process guidance, allowing you to successfully complete OA on your own computer. It is suitable for students preparing for major manufacturers such as Amazon, Microsoft, and Snowflake.

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END
 0