easyQueuePattern: Queue

Document Processing Order Solution

Problem Statement

You are given a list of document IDs representing documents waiting to be processed. Documents are processed in a First-In-First-Out (FIFO) manner. Return a list of document IDs in the order they will be processed.

Examples

Example 1:
Input:["doc1", "doc2", "doc3"]
Output:["doc1", "doc2", "doc3"]
Explanation: Documents are processed in the exact order they are received.
Example 2:
Input:["report_a", "report_b"]
Output:["report_a", "report_b"]
Explanation: Even with different names, the FIFO principle dictates the order.
Example 3:
Input:[]
Output:[]
Explanation: An empty input list results in an empty output list.

Constraints

  • The input list can contain between 0 and 1000 document IDs.
  • Each document ID is a non-empty string.
  • Document IDs can contain alphanumeric characters and underscores.
  • The total length of all document IDs will not exceed 100,000 characters.
Time: O(N) Space: O(N)
The problem statement implies a FIFO processing order. Given an input list representing arrival order, the output list will be identical to the input list. No additional data structures or complex operations are required.

Run, Test & Submit Code

Ready to practice this challenge? Launch our interactive compilation environment with compiler validation.

Solve on Interactive Workspace

Tested Solutions

def document_processing_order(document_ids): return document_ids