FastPrepMeandering Array
Problems/Meandering Array

Meandering Array

Verisk logoVerisk● EasyFULLTIMEOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report explicitly defines a meandering array as alternating the maximum and minimum remaining values, gives the function name, and bounds the input length. Numeric value bounds and examples are supplied for execution. Approximate source match: 94%.

You are given an integer array unsorted. Rearrange it in meandering order: take the largest remaining value, then the smallest remaining value, and keep alternating.

The order is [first_largest, first_smallest, second_largest, second_smallest, ...].

Complete meanderingArray(unsorted) and return the rearranged integer array. Keep every input entry, including duplicates.

Function

meanderingArray(unsorted: int[]) → int[]

Examples

Example 1

unsorted = [-1, 1, 2, 3, -5]return = [3, -5, 2, -1, 1]

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, 1].

Constraints

  • 2≤n≤10^5
  • -10^6 ≤ unsorted[i] ≤ 10^6
  • The unsorted array may contain duplicate elements.

More Verisk Online Assessment questions

  • Companies Above a Salary ThresholdOA · Seen Oct 2026

Similar questions at other companies

  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Count Cross-Array Target-Sum PairsVisa · OAVisa interview questions
  • Can Every Package Fit in a BoxIMC Trading · OAIMC Trading interview questions
  • Minimum Tunnel Crossing TimeArcesium · OAArcesium interview questions
  • Merge 2 ArraysIBM · OAIBM interview questions
  • Get Maximum PairsAmazon · OA
  • Merge 2 ArraysOracle · OAOracle interview questions
  • Find Maximum GreatnessTwilio · OATwilio interview questions
  • Merge Sorted ArrayAtlassian · OAAtlassian interview questions
  • Binge WatchingVanguard · OAVanguard interview questions
See Verisk hiring insights
Saved
class Solution {
    public int[] meanderingArray(int[] unsorted) {
      // write your code here
    }

}
Checking account…