you give 0indexed integer array num integer pivot Rearrange num follow condition satisfiedEvery element pivot appear element great pivotevery element equal pivot appear element great pivotthe relative order element pivot element great pivot maintainedMore formally consider pi pj pi new position ith element pj new position jth element for element pivot j numsi pivot numsj pivot pi pj Similarly element great pivot j numsi pivot numsj pivot pi pjreturn num rearrangement Example 1input num 91251014310 pivot 10output 95310101214explanation the element 9 5 3 pivot leave arraythe element 12 14 great pivot right arraythe relative ordering element great pivot maintain 9 5 3 12 14 respective orderingsExample 2input num 3432 pivot 2output 3243explanation the element 3 pivot leave arraythe element 4 3 great pivot right arraythe relative ordering element great pivot maintain 3 4 3 respective ordering Constraints1 numslength 105106 numsi 106pivot equal element num