educative.io

Educative

Https://www.educative.io/courses/data-structures-interviews-cs

I have used QuickSort to solve the problem and test cases are passed but the sequence of elements is different and it is showing me that all test cases are passed. @Educative_CS can you please explain.

Hi @ahmed_anwar !!
The order of the numbers is not important as long as all negative numbers are grouped together on the left and all positive ones on the right. For example, both of the following are valid outputs for the same input:[-23,1,-2,0,44,-9,8]

  • [-23,-2,-9,0,44,1,8]
  • [-23,-9,-2,0,1,44,8]
    I hope it helps. Happy Learning :blush:
2 Likes