DEV Community

Cover image for Amazon HackerRank OA | 2026 Real Questions + Coding Solutions
net programhelp
net programhelp

Posted on

Amazon HackerRank OA | 2026 Real Questions + Coding Solutions

Amazon’s Online Assessment platform is consistently based on HackerRank. Most candidates receive 2 coding questions within 90 minutes, although a small number of OA versions contain 3 questions.

Compared with previous years, Amazon OA has become much more engineering-oriented. Instead of pure LeetCode pattern matching, candidates are increasingly expected to analyze realistic scenarios, optimize performance, and handle edge cases carefully.

Overall OA Structure

Question Difficulty Expected Time
Question 1 Easy-Medium 20-25 minutes
Question 2 Medium-Hard 50-60 minutes

What Amazon Actually Evaluates

  • Code readability and structure
  • Boundary condition handling
  • Time complexity optimization
  • Practical engineering thinking
  • Communication through clean implementation

Common failure points include:

  • O(n²) solutions timing out
  • Incorrect handling of empty arrays or single elements
  • Ring/circular indexing mistakes
  • Missing overflow or large-input considerations

Real OA Question #1 — Circular Delivery Minimum Time

Difficulty: Easy-Medium

Problem Description

Amazon's drone delivery system contains m hubs arranged in a circular topology. Hub 1 is adjacent to hub m.

You are given:

  • transitionTime: travel time between adjacent hubs
  • requestedHubs: sequence of delivery requests

The drone starts at hub 1. For each request, it may travel clockwise or counterclockwise. Return the minimum total travel time.

Example

m = 3
transitionTime = [3, 2, 1]
requestedHubs = [1, 3, 3, 2]

Output: 4

Core Idea

  • Any two hubs have two possible paths in a ring
  • Precompute prefix sums for fast clockwise distance calculation
  • Counterclockwise distance = total ring length - clockwise distance
  • Take the minimum for each transition

Python Solution


def minDeliveryTime(m, transitionTime, requestedHubs):
    prefix = [0] * (m + 1)

    for i in range(1, m + 1):
        prefix[i] = prefix[i - 1] + transitionTime[i - 1]

    ring_total = prefix[m]
    total_time = 0
    curr = 1

    for next_hub in requestedHubs:

        if next_hub == curr:
            continue

        # clockwise distance
        if next_hub > curr:
            clockwise = prefix[next_hub - 1] - prefix[curr - 1]
        else:
            clockwise = (
                prefix[m]
                - prefix[curr - 1]
                + prefix[next_hub - 1]
            )

        counterclockwise = ring_total - clockwise

        total_time += min(clockwise, counterclockwise)

        curr = next_hub

    return total_time

Important Notes

  • Careful with 1-based indexing
  • Ring traversal logic is easy to get wrong
  • Prefix sum preprocessing is the key optimization

Real OA Question #2 — Dynamic Task Scheduler

Difficulty: Medium-Hard

Problem Description

You are given tasks with:

  • arrival time
  • processing duration
  • priority

Design a scheduler in a multi-core environment that:

  • maximizes completed tasks
  • supports dynamic arrivals
  • supports preemptive scheduling
  • prioritizes high-priority tasks

Solution Strategy

  • Sort tasks by arrival time
  • Use a max-heap / priority queue
  • Simulate timeline progression
  • Handle arrival and completion events dynamically

Python Framework


import heapq

def maxTasks(tasks):

    # tasks = [
    #   [arrival, processing_time, priority]
    # ]

    tasks.sort()

    pq = []

    time = 0
    completed = 0
    i = 0

    while i < len(tasks) or pq:

        if not pq:
            time = tasks[i][0]

        while i < len(tasks) and tasks[i][0] <= time:
            heapq.heappush(
                pq,
                (-tasks[i][2], tasks[i][1] + time)
            )
            i += 1

        if pq:
            _, end_time = heapq.heappop(pq)

            time = max(time, end_time)

            completed += 1

    return completed

Common Follow-Up Questions

  • How would you support true preemption?
  • How would this scale in distributed systems?
  • How would you handle memory constraints?
  • How do you avoid starvation for low-priority tasks?

Preparation Advice

Time Management

  • Question 1: finish within 25 minutes
  • Reserve at least 50 minutes for Question 2

High-Frequency Topics

  • Circular arrays
  • Task scheduling
  • Greedy algorithms
  • Sliding window
  • Priority queues
  • Graph traversal
  • Dynamic programming

Practice Strategy

  • Simulate full HackerRank exams under strict 90-minute timing
  • Focus on Medium-Hard LeetCode problems
  • Train edge-case analysis intentionally
  • Review time complexity after every problem

Final Thoughts

One important realization during preparation was that blindly grinding problems was not the most efficient strategy. The biggest improvement came from targeted mock interviews, optimization reviews, and learning how to approach OA questions from an engineering perspective rather than only algorithm memorization.

For candidates preparing for Amazon, TikTok, Point72, and other major tech company OAs, structured preparation and realistic simulation can significantly improve performance under pressure.

If you're interested in additional interview preparation resources, coding guidance, or OA-focused practice support, you can explore:

ProgramHelp Interview Preparation Platform

  • 2025-2026 latest OA question collections
  • Full mock OA simulations
  • Code optimization training
  • Interview preparation coaching
  • System design communication practice

Thanks for reading, and good luck with your Amazon OA preparation.

Top comments (0)