C++ launchpad (SORTING IN LINEAR TIME)

code-https://ide.codingblocks.com/s/73601
doubt -where is error 1 test case failed

question-SORTING IN LINEAR TIME
You will be given an array containing only 0s, 1s and 2s. you have sort the array in linear time that is O(N) where N is the size of the array.

Input Format:
The first line contains N, which is the size of the array. The following N lines contain either 0, or 1, or 2.

Constraints:
Each input element x, such that x ∈ { 0, 1, 2 }.

Output Format
Output the sorted array with each element separated by a newline.

Sample Input
5
0
1
2
1
2
Sample Output
0
1
1
2
2

@S18LPC-OL0078 array can be larger than 50 so declare your array as arr[arr_size];

still showing 1st test case as wrong answer

please see this problem also

@S18LPC-OL0078 hey rishav declare your array after you take array size otherwise array will take garbage value
so
cin>>arr_size;
int arr[arr_size];

1 Like