Description
Solutions
Construct Winning Sequence
🔥 FULLTIME📚RELATED PROBLEMS
A challenge in a programming competition requires the construction of a sequence using a specified number of integers within a range. The sequence must be strictly increasing at first and then strictly decreasing. The goal is to maximize the sequence array elements starting from the beginning. For example, [4,5,4,3,2]
beats [3,4,5,4,3]
because its first element is larger, and [4,5,6,5,4]
beats [4,5,4,3,2]
because its third element is larger. Given the length of the sequence and the range of integers, return the winning sequence. If it is not possible to construct such a sequence, return -1
.
Example 1:
Input: n = 5, lo = 1, hi = 2
Output: [-1]
Explanation:It is not possible to construct a sequence that is strictly increasing and then strictly decreasing with the given range of integers.
Example 2:
Input: n = 5, lo = 4, hi = 11
Output: [10, 11, 10, 9, 8]
Explanation:N/A
Example 3:
Input: n = 6, lo = 5, hi = 10
Output: [9, 10, 9, 8, 7, 6]
Explanation:N/A
Constraints:
N/A

Related Problems
Testcase
Result
Case 1
input:
output: