MERN Assessment 2023
MERN Assessment 2023
ASSESSMENT
TEST 2023
MERN
Problem Solving Question:
Write a function shuffle(arr)that takes input an array of numbers and returns an array by ordering the
numbers in following fashion:
a1 <= a2 >= a3 <= a4 >= ....
Please note that there are multiple outputs that are possible for a given array. Your function can return
one possible output.
Example: If input is [2, 1, 5, 3, 11, 7], one possible output could be [2, 7, 3, 11, 1, 5]
Once you are done, please respond back with following details:
Description Response
Test Case 2:
Input: [8, 1, 3, 4, 5.5, -7, -1]
Output: [8, 1, 4, 3, 5.5, -7, -1]
Test Case 3:
Input: [ 4, 3, 2, 5, 4, 1]
Output: [ 4, 2, 5, 3, 4, 1 ]
One possible output array is
[ 4, 2, 5, 3, 4, 1 ]
Test Case 4:
Input: [2, -1, 3.3, 4, 1, 5, -8, 1]
Output: [2, -1, 4, 1, 5, -8, 3.3, 1]
Please make a copy of this document (under File -> Make a copy) instead of requesting edit
access to this document.