Hi Guys hope you under stand how to solve this problem by using the Swift Language. Our input and output arrays will be like this Input = [10,0,2,3,0,1,3,0], OutPut= [1,2,3,3,10,0,0,0] Step-1 Create a function which will take the array as an input and will return the array as an output. By…