amazon logo
Amazon· SDE I

Amazon India SDE1 OA 2025

Location
India
Posted
14 Jul 2025
327 reads

Summary

I recently completed my Amazon Online Assessment and encountered two detailed algorithmic problems: Optimal Task Pairing and Printer Fleet Optimization.

How it went

Recently completed my Amazon OA and wanted to share the two questions I encountered.

Question 1: Optimal Task Pairing

Problem Statement:
You are planning a work schedule for n days. You have a pool of n important tasks and a pool of n optional tasks.

Given:

  • An integer array important_tasks of length n
  • An integer array optional_tasks of length n
  • An integer daily_time_limit

Rules:

  • You have exactly n days to work
  • On each day, you must complete exactly one task from the important_tasks pool
  • Since there are n tasks and n days, you will complete all important tasks by the end
  • On any day, after completing your chosen important task, you may also complete at most one task from the optional_tasks pool
  • The combined time for tasks done on any single day must not exceed the daily_time_limit
  • Each task (both important and optional) can only be done once
  • You have the freedom to decide which important task to pair with which optional task on any of the n days

Goal: Return the maximum total number of optional tasks you can complete.

Example:

Input: important_tasks = [8, 9], optional_tasks = [1, 3], daily_time_limit = 11
Output: 2

Explanation:
A naive greedy approach might be:

  • Pair 8 with 1: 8 + 1 = 9 ≤ 11 ✓
  • Pair 9 with 3: 9 + 3 = 12 > 11 ✗

This yields only 1 optional task.

However, optimal pairing:

  • Day 1: important task 8 + optional task 3 = 11 ≤ 11 ✓
  • Day 2: important task 9 + optional task 1 = 10 ≤ 11 ✓

This allows completing 2 optional tasks.


Question 2: Printer Fleet Optimization

Problem Statement:
You are in charge of a fleet of n printers. For each printer, you are given its printing speed and a suspension threshold. Your goal is to select a group of printers to activate to maximize the total number of pages printed in one unit of time.

Given:

  • Two integer arrays pages and threshold, both of length n
  • pages[i] is the number of pages printer i can print
  • threshold[i] is the suspension threshold for printer i

Rules:

  • You decide to activate a group of X printers
  • This triggers a system-wide check: any printer i (regardless of whether you chose to activate it or not) for which threshold[i] <= X is suspended after the current round
  • A suspended printer cannot print any pages
  • The X printers you choose to activate must not be part of the suspended set

Goal: Find the maximum total number of pages that can be printed by a valid selection of active, non-suspended printers.

Questions asked (2)

  1. 01

    Optimal Task Pairing

    Data Structures & Algorithms

    Problem Statement:
    You are planning a work schedule for n days. You have a pool of n important tasks and a pool of n optional tasks.

    Given:

    • An integer array important_tasks of length n
    • An integer array optional_tasks of length n
    • An integer daily_time_limit

    Rules:

    • You have exactly n days to work
    • On each day, you must complete exactly one task from the important_tasks pool
    • Since there are n tasks and n days, you will complete all important tasks by the end
    • On any day, after completing your chosen important task, you may also complete at most one task from the optional_tasks pool
    • The combined time for tasks done on any single day must not exceed the daily_time_limit
    • Each task (both important and optional) can only be done once
    • You have the freedom to decide which important task to pair with which optional task on any of the n days

    Goal: Return the maximum total number of optional tasks you can complete.

    Example:

    Input: important_tasks = [8, 9], optional_tasks = [1, 3], daily_time_limit = 11
    Output: 2
    

    Explanation:
    A naive greedy approach might be:

    • Pair 8 with 1: 8 + 1 = 9 ≤ 11 ✓
    • Pair 9 with 3: 9 + 3 = 12 > 11 ✗

    This yields only 1 optional task.

    However, optimal pairing:

    • Day 1: important task 8 + optional task 3 = 11 ≤ 11 ✓
    • Day 2: important task 9 + optional task 1 = 10 ≤ 11 ✓

    This allows completing 2 optional tasks.

  2. 02

    Printer Fleet Optimization

    Data Structures & Algorithms

    Problem Statement:
    You are in charge of a fleet of n printers. For each printer, you are given its printing speed and a suspension threshold. Your goal is to select a group of printers to activate to maximize the total number of pages printed in one unit of time.

    Given:

    • Two integer arrays pages and threshold, both of length n
    • pages[i] is the number of pages printer i can print
    • threshold[i] is the suspension threshold for printer i

    Rules:

    • You decide to activate a group of X printers
    • This triggers a system-wide check: any printer i (regardless of whether you chose to activate it or not) for which threshold[i] <= X is suspended after the current round
    • A suspended printer cannot print any pages
    • The X printers you choose to activate must not be part of the suspended set

    Goal: Find the maximum total number of pages that can be printed by a valid selection of active, non-suspended printers.

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!