• Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It's approved already, but plz have a look at issue by @Unnamed just above.

  • Custom User Avatar
  • Custom User Avatar

    Not a kata issue, you have to sort the list in place. If you don't know what that is, read B1ts's answer to Hunahpu2's post below.

  • Custom User Avatar

    thank you!

  • Custom User Avatar

    Oh thank you. I read it the otherway around for some reason... Thank you I could submit

  • Custom User Avatar

    The expression equals(arr, cln, n) is false.

    It means the array isn't in the required 'wave' order.

    You can print the array at the end of your function to see what it looks like. In your case, it is:

    47 22 23 23 33 14 46 9 39 13 29 29 91 91

    You can see there's many places where it's incorrect.

  • Custom User Avatar

    The expression equals(arr, cln, n) is false.

    What does that mean? I can't figure out what's wrong with my code.

    void wave_sort(int arr[], int arr_size){
    for(int i=0; i<arr_size; i++)
    {
    if (i%2==0)
    {
    if (arr[i]<arr[i+1])
    {
    arr[i]=arr[i+1];
    }
    }
    if(i%2!=0)
    {
    if(arr[i]>arr[i+1])
    {
    arr[i]=arr[i+1];
    }
    }
    }

    }