you give array consist n integerseach position 1 le le n array lock unlock you value unlocked position rearrange order place unlocked position you allow remove value add new one rearrange value lock position you allow leave value order werefor example let 1 1 underline3 2 underline2 1 4 underline0 underline position lock you obtain follow array 1 1 underline3 2 underline2 1 4 underline0 4 1 underline3 2 underline2 1 1 underline0 1 1 underline3 2 underline2 1 4 underline0 1 2 underline3 1 underline2 4 1 underline0 let p sequence prefix sum array rearrangement so p_1 a_1 p_2 a_1 a_2 p_3 a_1 a_2 a_3 dots p_n a_1 a_2 dots a_nlet k maximum j 1 le j le n p_j 0 if j p_j 0 k 0your goal rearrange value way k minimum possibleoutput array rearrangement value k minimum possible if multiple answer print