Company-style OA practice sets with full problem statements, sample test cases, and solutions.
Have you recently taken Amazon's Online Assessment or coding test? Share the questions, test cases, or assessment patterns you encountered. Earn SWE180 Coins for every verified submission and use them to unlock other company OA sets and premium tools for free!
AWS provides scalable systems. A set of n servers are used for horizontally scaling an application. The goal is to have the computational power of the servers in non-decreasing order.
To do so, you can increase the computational power of each server in any contiguous segment by x (x > 0). Choose the values of x such that after all operations, the computational powers are in non-decreasing order, and the sum of the x values is minimum.
Given the initial array power[n] representing the computational powers of the servers, determine the minimum sum of x values needed to make the array non-decreasing.
Example 1
Input
5 3 4 1 6 2
Output
7
Explanation
Initial array: [3, 4, 1, 6, 2].
- Add 3 units to subarray (2, 4): [3, 4, 4, 9, 5].
- Add 4 units to subarray (4, 4): [3, 4, 4, 9, 9].
Array is now in non-decreasing order. Sum of x = 3 + 4 = 7.
Example 2
Input
3 3 2 1
Output
2
Explanation
Initial array: [3, 2, 1].
- Drop from index 0 to 1 is 3 - 2 = 1.
- Drop from index 1 to 2 is 2 - 1 = 1.
Total minimum sum of x = 1 + 1 = 2.
Workflow is an app that allows teams to manage and track their work efficiently. The commenting system enables team members to discuss issues, provide updates, and collaborate on solutions. Currently, this feature is not functioning correctly, affecting team communication and collaboration.
Issue Summary:
When users attempt to add comments to issues or edit their own comments, the changes do not appear or persist. Fix the comment creation and editing feature in the backend.
Requirements & HTTP Error Handling:
1. POST /api/issues/{issueId}/comments:
- Authentication: If user is not authenticated, return 401 Unauthorized with {"message": "Not authenticated"}.
- Validation: If content is empty, null, or whitespace only, return 400 Bad Request with {"message": "Content is required"}.
- Persistence: Associate comment with the issue and authenticated user. Return 201 Created with the saved comment.
2. PUT /api/comments/{commentId}:
- Authentication: If user is not authenticated, return 401 Unauthorized with {"message": "Not authenticated"}.
- Validation: If content is empty or missing, return 400 Bad Request with {"message": "Content is required"}.
- Existence: If comment does not exist, return 404 Not Found with {"message": "Comment not found"}.
- Authorization: If authenticated user is NOT the creator/owner of the comment, return 403 Forbidden with {"message": "Not authorized"}.
- Persistence: Update content, set isEdited = true, update updatedAt timestamp, save and return 200 OK.
Example 1
Input
POST /api/issues/1/comments
Headers: Authorization: Bearer <valid_token>
Body: {"content": "Initial update on investigation"}Output
HTTP 201 Created
{
"id": 101,
"content": "Initial update on investigation",
"isEdited": false,
"user": {"email": "[email protected]"}
}Explanation
Authenticated user creates comment with valid content. Comment is persisted and returned with 201 status.
Example 2
Input
PUT /api/comments/101
Headers: Authorization: Bearer <other_user_token>
Body: {"content": "Unauthorized edit attempt"}Output
HTTP 403 Forbidden
{"message": "Not authorized"}Explanation
User attempting edit is not comment owner. Access is forbidden.
Gain complete transparency into the Amazon online assessment process. Prepare effectively with real, verified coding challenges, test patterns, and platform details.
Wondering what top companies are actually asking in their initial screening rounds? We provide exact Data Structures, Algorithms, and logical reasoning questions reported by candidates who recently took the Amazon online tests. Stop guessing and start practicing the right problems.
Understand exactly how many questions to expect, the typical time limits, and the platforms used (e.g., HackerRank, Codility, CodeSignal). Knowing the format in advance is the first step to clearing the Amazon OA.