Question: Amazon SDE | Recent Online Assessment 2025 | Barcode Configuration & Deployment Parsing | 26oct 2025
0
Entering edit mode

Question 1: Barcode Scanner Configuration

Problem Statement: A barcode scanner can be configured by scanning a series of barcodes in the correct order. Barcode configurations are encoded into a single string and stored as a blob in the backend system. The client requests the configuration from the backend service and then needs to present the configurations in the correct order. The encoded configuration string is a series of <ordinal-index><configuration> pairs separated by |. The ordinal index value is a 4-digit numeric prefixed with zeros. For example, the first configuration will be represented as 0001.

The goals are to 1) validate the configuration string; and 2) provide the configuration client the configuration values in the order required to successfully configure the barcode scanner.

Validation Conditions:

  • All configurations must be separated by a | character.
  • Configurations cannot skip a number in the ordering. If there are three configuration strings, there must be a 1, 2, and 3 index.
  • Configuration values are alphanumeric and may contain no other characters.
  • Configuration value length is exactly 10 characters.
  • Ordinal indices may not repeat; for example, there cannot be two occurrences of the number 0001.
  • Each configuration value is unique; configurations do not repeat.
  • 0000 is not a valid ordinal index.

If a configuration string is not valid, return ["invalid configuration"].

Examples: Happy Path: configuration = "0002f7c22e7904|000176a3a4d214|000305d29f4a4b" Based on the "order" value, the expected output is: ["76a3a4d214", "f7c22e7904", "05d29f4a4b"]

 


Question 2: Deployment Parsing Logic

Problem Statement: In this challenge, you are provided with an array of deployment results. Parse the data and determine the number of deployments that were successful or unsuccessful. Also test that the JSON input is valid based on the parameters listed below; otherwise, mark it as an error.

Return the result with the number of deployments that were successful, failed, or errors encountered parsing the data.

Function Description: Complete the evaluate_deployments function. evaluate_deployments has the following parameter:

  • deployments[n]: an array of JSON string data with two required fields:
    • deployment_id: The valid format is a 12-character string starting with d- or u- and 10 lowercase alphanumeric characters.
    • status: Valid entries are Success or Fail.

Example Input:

[

  {"deployment_id": "u-123456abcd", "status": "Success"},

  {"deployment_id": "d-098765efgh", "status": "Fail"}

]

In this example, there is one in each category of success and fail with no input errors. This would return [1, 1, 0].

Returns: results[n]: an array of integers with the values of the deployment results:

  • results[0] = Number of successful deployments.
  • results[1] = Number of failed deployments.
  • results[2] = Number of errors parsing deployments.

Login before adding your answer.

Similar Posts
Loading Similar Posts