Amazon OA SDE 2
- Result
- Ongoing
- Location
- null
- Posted
- 31 Oct 2025
Summary
Attempted Amazon OA SDE 2 with a problem requiring finding the lexicographically smallest sequence meeting specific sum and permutation criteria.
How it went
given two integer size and target sum return the lexicography smallest sequence such that
1. the sum of its element equal to target sum
2. the absolute value of its element form permutation of size size
Example:
size=5, target_sum=9
ans=[-3,1,2,4,5]
Questions asked (1)
- 01
Lexicographically Smallest Sequence with Sum and Permutation Constraints
Data Structures & Algorithms 路 Hard
Given two integers, size and target sum, return the lexicographically smallest sequence such that:
1. The sum of its elements equals the target sum.
2. The absolute values of its elements form a permutation of size size.