subject
Computers and Technology, 17.08.2020 01:01 Paigex3

You are given an array of integers a. A new array b is generated by rearranging the elements of a in the following way: b[0] is equal to a[0];
b[1] is equal to the last element of a;
b[2] is equal to a[1];
b[3] is equal to the second-last element of a;
and so on.
Your task is to determine whether the new array b is sorted in strictly ascending order or not.
Example
For a = [1, 3, 5, 6, 4, 2], the output should be alternatingSort(a) = true.
The new array b will look like [1, 2, 3, 4, 5, 6], which is in strictly ascending order, so the answer is true.
For a = [1, 4, 5, 6, 3], the output should be alternatingSort(a) = false.
The new array b will look like [1, 3, 4, 6, 5], which is not in strictly ascending order, so the answer is false.
Input/Output
[execution time limit] 3 seconds (java)
[input] array. integer a
The given array of integers.
Guaranteed constraints:
1 ≤ a. length ≤ 105,
-109 ≤ a[i] ≤ 109.
[output] boolean
A boolean representing whether the new array bwill be sorted in strictly ascending order or not.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1×10-9m), and a human hair is about 1×10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Apart from confidential information, what other information does nda to outline? ndas not only outline confidential information, but they also enable you to outline .
Answers: 1
You know the right answer?
You are given an array of integers a. A new array b is generated by rearranging the elements of a in...
Questions
question
Computers and Technology, 26.10.2021 01:00
question
Mathematics, 26.10.2021 01:00
question
Mathematics, 26.10.2021 01:00
question
Mathematics, 26.10.2021 01:00
Questions on the website: 13722361