HackerRank 代考 Python 笔试OA代写全过

  1. Meandering Array
    An array of integers is defined as being in meandering order when the first two elements
    are the respective largest and smallest elements in the array and the subsequent
    elements alternate between its next largest and next smallest elements. In other words,
    the elements are in order of [first largest, first smallest, second_largest, second_smallest,
    Example
    The array [-1, 1, 2, 3, -5] sorted normally is [-5, -1, 1, 2, 3]. Sorted in meandering order, it
    becomes [3, -5, 2, -1, 17.
    Function Description
    Complete the function meanderingArray in the editor below.
    meanderingArray has the following parameter(s):
    unsorted/n]: the unsorted array
    Returns:
    intIn]: the array sorted in meandering order
    Constraints
    • 25n5 104
    -106 s unsortedlil ≤ 106
    • The unsorted array may contain duplicate elements.