We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16c8ee4 commit 2c2e5e5Copy full SHA for 2c2e5e5
3.Array/ClassCodes/merge.java
@@ -0,0 +1,26 @@
1
+
2
3
4
+public class merge {
5
+ public static void main(String[] args) {
6
+ int a1[] = {2,1,4,5};
7
+ int a2[]= {1,5,6,7};
8
9
+ int ans[] = new int[a1.length+a2.length];
10
11
12
+ for(int i=0;i<(a1.length+a2.length);i++){
13
+ if(i<a1.length){
14
+ ans[i] = a1[i];
15
+ }
16
+ else{
17
+ ans[i] = a2[i-a1.length];
18
19
20
21
+ for(int i=0;i<ans.length;i++){
22
+ System.out.print(ans[i]+" ");
23
24
25
26
+}
0 commit comments