Company: Amazon_13sep
Difficulty: medium
Lexicographically Smallest Sequence Problem Description Data scientists at Amazon are working on a utility to generate data points based on their models on existing data points. A simple prototype takes in two integers, n , and sequence_sum , and generates a sequence of size n whose sum of elements equals sequence_sum , and the absolute values of the elements form a permutation of size n . The utility reports the lexicographically smallest such sequence. Given two integers, n , and sequence_sum , return the lexicographically smallest sequence of integers such that: The sum of its elements equals sequence_sum . The absolute values of its elements form a permutation of size n . Note: A sequence of n integers is a permutation if it contains all integers from 1 to n exactly once. For example, [1, 2, 3, 4, 5] is a permutation but [2, 2, 3, 4, 5] is not. When the problem states "absolute values of its elements form a permutation of size n ", it means that the set of absolute values of the se