Wavy array algorithm

I am solving an algorithm question in geeksforgeeks website, and I was running my solution in Pycharm and it returned as the question wants, but when I check the code in their website it shows me that my output is the same as my input.This is the link to the problem, and below it my approach to the solution.

class Solution:
    #Complete this function
    #Function to sort the array into a wave-like array.
    def convertToWave(self,arr,N):
        self.arr = arr
        self.N = N
        self.new_arr = []
        i = 0
        while i < len(self.arr):
            if (i + 1) < len(self.arr):
            i += 2
        return self.new_arr
        #Your code here

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.