Amazon SDE-1 OA problems πŸ’‘

amazon logo
amazon
SDE-1
July 10, 2025 β€’ 6 reads

Summary

This post details the problems encountered during an Amazon SDE-1 Online Assessment, presenting two specific coding challenges with their full descriptions and examples.

Full Experience

Question 1

A user is using the Amazon fitness tracker, and they are engaged in a jumping exercise routine.

The user is positioned on the ground, and there are n blocks, each placed at different heights. The height of the i-th block is represented by height[i] feet.

The goal is to maximize the calorie burn during this exercise. The calories burned when jumping from block i to block j is calculated as:

Calories=(height[i]βˆ’height[j]) ^2

The user intends to practice jumping on each block exactly once but can choose the order in which they jump. Since the user wants to optimize their calorie burn for this session, the task is:

Given an array height of size n, representing the heights of the blocks, find the maximum amount of calories the user can burn.

Note:

The user starts from the ground (height = 0).

Once the user jumps to a block from the ground, they can never go back to the ground.

They must visit every block exactly once in some order.

Example

n = 3 height = [5, 2, 5] The user jumps:

ground β†’ block 3

block 3 β†’ block 2

block 2 β†’ block 1

Calories:

(0βˆ’5)^2 +(5βˆ’2)^2 +(2βˆ’5)^2 = 25+9+9 = 43 Return: 43

Question 2

Data scientists at Amazon are working on a utility for detecting similar passwords in their security systems.

The utility finds anagram patterns in pairs of passwords. A pair of passwords is considered similar if they are anagrams after removing any number of occurrences of at most one character from each password.

Given n pairs of passwords, for each pair, attempt to make them anagrams. Return a list of boolean values, one for each pair, where true means the pair is similar.

Note:

You are allowed to:

remove all occurrences of one character from password1

and remove all occurrences of one character from password2

Or you may leave each password unchanged.

It is not required that you remove anything at all.

Example

n = 1 password1 = "safddadfs" password2 = "famafmss" Remove all 'd' from password1 β†’ "safafs"

Remove all 'm' from password2 β†’ "faafss"

These two are anagrams. So return [true].

Interview Questions (2)

Q1
Maximize Calorie Burn by Jumping on Blocks
Data Structures & Algorithms

A user is using the Amazon fitness tracker, and they are engaged in a jumping exercise routine.

The user is positioned on the ground, and there are n blocks, each placed at different heights. The height of the i-th block is represented by height[i] feet.

The goal is to maximize the calorie burn during this exercise. The calories burned when jumping from block i to block j is calculated as:

Calories=(height[i]βˆ’height[j]) ^2

The user intends to practice jumping on each block exactly once but can choose the order in which they jump. Since the user wants to optimize their calorie burn for this session, the task is:

Given an array height of size n, representing the heights of the blocks, find the maximum amount of calories the user can burn.

Note:

The user starts from the ground (height = 0).

Once the user jumps to a block from the ground, they can never go back to the ground.

They must visit every block exactly once in some order.

Example

n = 3 height = [5, 2, 5] The user jumps:

ground β†’ block 3

block 3 β†’ block 2

block 2 β†’ block 1

Calories:

(0βˆ’5)^2 +(5βˆ’2)^2 +(2βˆ’5)^2 = 25+9+9 = 43 Return: 43

Q2
Detect Similar Passwords (Anagrams with One Character Removal)
Data Structures & Algorithms

Data scientists at Amazon are working on a utility for detecting similar passwords in their security systems.

The utility finds anagram patterns in pairs of passwords. A pair of passwords is considered similar if they are anagrams after removing any number of occurrences of at most one character from each password.

Given n pairs of passwords, for each pair, attempt to make them anagrams. Return a list of boolean values, one for each pair, where true means the pair is similar.

Note:

You are allowed to:

remove all occurrences of one character from password1

and remove all occurrences of one character from password2

Or you may leave each password unchanged.

It is not required that you remove anything at all.

Example

n = 1 password1 = "safddadfs" password2 = "famafmss" Remove all 'd' from password1 β†’ "safafs"

Remove all 'm' from password2 β†’ "faafss"

These two are anagrams. So return [true].

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!