Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String [] KetHop(String A[], String B[]) {
- int cLength = A.length + B.length - 1;
- String C[] = new String[cLength + 1];
- int i = 0, j = 0, n = 0;
- if (A.length > B.length) {
- n = B.length;
- } else {
- n = A.length;
- }
- while (i <= cLength) {
- if (j < n) {
- C[i] = A[j];
- C[i + 1] = B[j];
- i += 2;
- } else {
- if (n == A.length) {
- C[i] = B[j];
- } else {
- C[i] = A[j];
- }
- i += 1;
- }
- j += 1;
- }
- return C;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement