diff --git a/01_array/05_negative_ele_to_one_side_of_array.cpp b/01_array/05_negative_ele_to_one_side_of_array.cpp index b30a44f..1e2a8c9 100644 --- a/01_array/05_negative_ele_to_one_side_of_array.cpp +++ b/01_array/05_negative_ele_to_one_side_of_array.cpp @@ -21,8 +21,8 @@ void arrange(int a[], int n) { } else if (a[negi] > 0 && a[posi] > 0) posi--; else { - low++; - high--; + negi++; + posi--; } } } \ No newline at end of file diff --git a/01_array/09_minimize_the_height.cpp b/01_array/09_minimize_the_height.cpp index af89ae0..ba3169f 100644 --- a/01_array/09_minimize_the_height.cpp +++ b/01_array/09_minimize_the_height.cpp @@ -21,4 +21,4 @@ int getMinDiff(int arr[], int n, int k) { ans = min(ans, curr_max - curr_min); } return ans; -} \ No newline at end of file +} diff --git a/01_array/12_merge_2_sorted_array.cpp b/01_array/12_merge_2_sorted_array.cpp index 6585dca..4cd4cf6 100644 --- a/01_array/12_merge_2_sorted_array.cpp +++ b/01_array/12_merge_2_sorted_array.cpp @@ -47,8 +47,7 @@ void merge(int ar1[], int ar2[], int n, int m) int i, last = ar1[n - 1]; // here array will be making space for the new element to insert - for (i = n - 2; i >= 0 - && ar1[i] > ar2[j]; i--) + for (i = n - 2; i >= 0 && ar1[i] > ar2[j]; i--) ar1[i + 1] = ar1[i]; // If there was a greater element diff --git a/01_array/16_count_inversion.cpp b/01_array/16_count_inversion.cpp index f9ce8a4..d56ff1b 100644 --- a/01_array/16_count_inversion.cpp +++ b/01_array/16_count_inversion.cpp @@ -3,7 +3,7 @@ video (recommended to save time): https://youtu.be/kQ1mJlwW-c0 - condition here is convertion counts if (arr[i]>arr[j] && iarr[j] && i& parent, vector& rank) { rank[u]++; } } + int main() { int N, m; cin >> N >> m;