Amazon Software Engineer Interview Experience — Fresh OA with a Window-Sort Coding Question and an AI Debug Task

Amazon·Software Engineer·Oct 2026
Online Assessmentmedium

I just did the Amazon OA yesterday (10/9/2026). One coding question and one AI Debug.

Coding question:

Question 1 — Maximize Shipment Order

You're working in Amazon's logistics optimization team, where shipments are processed in order before dispatch.

You are given an integer windowSize and an array shipmentOrder of length n, which is a permutation containing each integer from 1 to n exactly once.

You are allowed to perform the following operation exactly once:

Choose a starting position i such that 1 ≤ i ≤ (n − windowSize + 1).
Consider the contiguous window of windowSize shipments starting at position i (from index i to i + windowSize − 1).
Reorder only this window in ascending numerical order, while keeping all other positions unchanged.
After performing this operation exactly once, the shipment order is finalized.

Your objective is to determine the lexicographically largest shipment order that can be obtained.

Note

Given two arrays A and B of equal length, A is lexicographically larger than B if at the first index where they differ, A has the larger value.

The reordering operation must be applied exactly once on shipmentOrder.

If the selected window is already in ascending order, reordering it leaves the array unchanged. Choosing an already-sorted window is valid, which is optimal if reordering any other window would make the array lexicographically smaller.

1-based indexing is used throughout the problem description.

Example

n = 5
shipmentOrder = [5, 1, 4, 3, 2]
windowSize = 3

Possible operations (1-indexed windows of length 3):

Choose i = 1:
Sort [5, 1, 4] → [1, 4, 5]
shipmentOrder = [1, 4, 5, 3, 2]

Choose i = 2:
Sort [1, 4, 3] → [1, 3, 4]
shipmentOrder = [5, 1, 3, 4, 2]

Choose i = 3:
Sort [4, 3, 2] → [2, 3, 4]
shipmentOrder = [5, 1, 2, 3, 4]

Comparing the achievable orders, the lexicographically largest result is: [5, 1, 3, 4, 2]

Function Description

Complete the function maximizeShipmentOrder in the editor below.

maximizeShipmentOrder takes the following arguments:

int shipmentOrder[n]: an array of integers representing shipment order
int windowSize: an integer representing the window size

Returns

int[n]: an array of integers representing the lexicographically largest shipment order achievable.

Constraints

1 ≤ windowSize ≤ n ≤ 2 * 10^5
1 ≤ shipmentOrder[i] ≤ n
shipmentOrder is a permutation of integers from 1 to n.

AI Debug:

This was mentioned on the forum before, it's something like Jira. The bug is that creating an Issue and a sub-issue is broken.

Published

Curated and edited by PracHub

Practice the questions from this interview

Discussion

Sign in to join the discussion. The author is notified of every comment.

Loading comments…

Interview at a glance

Company
Amazon
Role
Software Engineer
Rounds
Online Assessment
Difficulty
medium
Interview date
Oct 2026
Questions from this interview
1 question

Real Amazon interview experiences

First-hand reports from Amazon candidates — the rounds, the questions they were asked, and how it went.

All 155 Amazon interview experiences