2161. Partition Array According to Given Pivot : 08/06/2026

🚀 LeetCode 2161 | Partition Array According to Given Pivot | C++ Solution | Easy Explanation In this video, we solve LeetCode 2161 - Partition Array According to Given Pivot using an efficient O(n) Time Complexity approach. We will understand the problem statement, discuss the intuition behind the solution, and implement the optimized C++ code step by step. 📌 Problem Highlights Partition the array around a given pivot. Maintain the relative order of elements. Place elements smaller than the pivot first. Follow with elements equal to the pivot. Place elements greater than the pivot at the end. 💡 Approach Traverse the array once. Store elements in three separate containers: Less than pivot Equal to pivot Greater than pivot Merge the containers to form the final answer. ⏱️ Complexity Analysis Time Complexity: O(n) Space Complexity: O(n) 🔗 Problem Link LeetCode 2161 - Partition Array According to Given Pivot 🏷️ Tags #leetcode #leetcode2161 #partitionarrayaccordingtogivenpivot #cpp #cplusplus #codinginterview #datastructures #algorithms #competitiveprogramming #programming #coding #leetcodeeasy #interviewpreparation #softwareengineer #dsa 🔥 If you found this explanation helpful, don't forget to Like, Share, and Subscribe for more LeetCode solutions and coding interview preparation content!