Question: 
Write a function to re-arrange the elements of the given array so that all negative elements appear before positive ones.


Model's Code:
def re_arrange_array(arr, n):
    negative = [x for x in arr if x < 0]
    positive = [x for x in arr if x >= 0]
    return negative + positive



Sample Correct Code:
def re_arrange_array(arr, n):
  j=0
  for i in range(0, n):
    if (arr[i] < 0):
      temp = arr[i]
      arr[i] = arr[j]
      arr[j] = temp
      j = j + 1
  return arr


Asserts:
assert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]
assert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]
assert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 229 of 974: 167/229 (72.92576419213974%): failed