subject
Computers and Technology, 04.01.2021 20:00 rome58

A challenge in an amazon hackathon 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. Write an algorithm that returns a winning sequence and -1 if the sequence is not possible.
Input
The input to the function/method consists of three arguments: num, an integer representing the size of sequence to create; lowerEnd, an integer representing the lower end of integer range; upperEnd, an integer representing the upper end of integer range.
Output
Return a list of integers representing the winning sequence and if the sequence is not possible then return a list with an integer -1.
Constraints
3 <= num <= 1045
1 <= lowerEnds <= upperEnds <= 1045
Example
Input:
num = 5
lowerEnd = 3
upperEnd = 10
Output:
[9,10,9,8,7]
Explanation:
In this case, [9, 10, 9, 8, 7] is the winning sequence. It maintains the constraints of being first strictly increasing and then strictly decreasing, and there is no way to have integers in the sequence that are greater than [9, 10, 9, 8, 7]. So the output is [9, 10, 9, 8, 7].

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
1. technician a says horsepower information can be used by consumers to compare the power of different automobile engines. technician b says that manufacturers will often list the horsepower output of their engines in the online service information. who is right?
Answers: 2
question
Computers and Technology, 22.06.2019 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 24.06.2019 08:20
Evaluate the scenario below and indicate how to handle the matter appropriately. situation: michael received an e-mail from what he thought was his doctor’s office, requesting his social security number. since he had just been in to see his doctor last week, he replied to the e-mail with his social security number.
Answers: 2
question
Computers and Technology, 24.06.2019 18:00
Hacer un algoritmo que me permita ingresar el nombre de una parcela de terreno y muestre junto al mensaje “tipo de suelos: suelos fumíferos, ¡excelente!
Answers: 1
You know the right answer?
A challenge in an amazon hackathon programming competition requires the construction of a sequence u...
Questions
question
Social Studies, 20.10.2020 06:01
question
Mathematics, 20.10.2020 06:01
question
Advanced Placement (AP), 20.10.2020 06:01
question
Mathematics, 20.10.2020 06:01
question
Mathematics, 20.10.2020 06:01
question
Mathematics, 20.10.2020 06:01
Questions on the website: 13722362