Solution Review: Array Waveform
Let’s take a detailed look at two solutions to the challenge set in the previous lesson.
First solution
Compare the value of every even index with the values of its previous and next odd indices. Swap the pair if the value at the odd index is not less than the value at the even index. The solution idea is presented in the following illustration.
Get hands-on with 1400+ tech skills courses.