Moving negative element to left side on an array

I was solving this problem
https://www.codechef.com/problems/MOVENE01?tab=statement

My solution to this problem was https://www.codechef.com/viewsolution/83422779
which I think is correct, but it’s not accepting my solution maybe because there’s a problem in test cases “- 3 1 -2 4 7 -1” there’s a whitespace between - and 3 so it doesn’t consider it as a negative number.

  • Initialize two variables leftIndex and rightIndex to index 0 and N-1.
  • Find first +ve number by moving leftIndex from left to right
  • Find first -ve number by moving rightIndex from right to left.
  • Swap array[leftIndex] and array[rightIndex].
  • Repeat above process till rightIndex > leftIndex
    Here is the full C program implementation to sort of the above algorithm in C. This C program is similar to sorting 0 and 1 in an array.