BackmediumStack Adobe

Galactic Supply Chain Management Solution

Problem Statement

Given a stack representing a galactic supply chain and a series of operations to add or remove cargo shipments, determine the final state of the cargo stack after applying these operations. Each operation is either of type 'import' with a specific cargo quantity or 'export' to remove the top shipment from the stack. The resulting stack should reflect the order in which shipments were added, considering all applied operations.

Example 1
Input
['import', 500, 'import', 750, 'export', 'import', 300, 'export']
Output
[500]

Explanation: Step-by-step: 1. Import 500 into the stack: [500]. 2. Import 750 into the stack: [500, 750]. 3. Export from the stack: [500]. 4. Import 300 into the stack: [500, 300]. 5. Export from the stack: [500].

Example 2
Input
['import', 400]
Output
[400]

Explanation: Step-by-step: 1. Import 400 into the stack: [400].

Constraints

  • The number of operations will not exceed 1000.
  • The quantity of each cargo shipment will be between 1 and 10000.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free