From 2878fe02300452dc540838e587738c73a362382a Mon Sep 17 00:00:00 2001 From: Saiteja Mahankali <81941814+saiteja-2731@users.noreply.github.com> Date: Thu, 23 Sep 2021 22:07:28 +0530 Subject: [PATCH] Update Sort_Array_zero_one_two.cpp --- .../Sort_Array_zero_one_two.cpp | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Sort_Array_zero_one_two/Sort_Array_zero_one_two.cpp b/Sort_Array_zero_one_two/Sort_Array_zero_one_two.cpp index 12d7f97c12..3218a93f82 100644 --- a/Sort_Array_zero_one_two/Sort_Array_zero_one_two.cpp +++ b/Sort_Array_zero_one_two/Sort_Array_zero_one_two.cpp @@ -7,21 +7,19 @@ using namespace std; void sort_zero_one_two(int a[],int n) { - int zero = 0; //counter to store number of 0's - int one = 0; //counter to store number of 1's - for(int i = 0 ;i < n; i++) - { - if(a[i] == 0) - zero++; - else if(a[i] == 1) - one++; + int count = 0; + for(int i=0;i