Three Partition Array

Problem Overview

  • Partition an integer array into three parts: < lowVal, within [lowVal, highVal], and > highVal.
  • Input: int array, lowVal, highVal; Output: array rearranged; within-group order irrelevant; if both exist, lowVal precedes highVal.
  • Real-world context: bucketizing data by thresholds for fast categorization.
  • From Microsoft interviews: a coding interview problem and common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: