class Solution {
public:
void merge(int A[], int m, int B[], int n) {
int C[m+n];
int i = 0 , j = 0, k = 0;
while ( i < m && j < n ) {
if( A[i] <= B[j] ) {
C[k++] = A[i++];
}
else {
C[k++] = B[j++];
}
}
while ( i < m ) {
C[k++] = A[i++];
}
while ( j < n ) {
C[k++] = B[j++];
}
for( i = 0 ; i < m+n ; i++ ) {
A[i] = C[i];
}
}
};
System Design for Beginners
A masterclass that helps early engineers and product managers become great at designing scalable systems.
180+ learners
Details →System Design Masterclass
A masterclass that helps you become great at designing scalable, fault-tolerant, and highly available systems.
1000+ learners
Details →Redis Internals
Learn internals of Redis by re-implementing some of the core features in Golang.
98+ learners
Details →