Answers for "concatenate arrays"

3

join two numpy 2d array

import numpy as np

a = np.array([[0, 1, 3], [5, 7, 9]])
b = np.array([[0, 2, 4], [6, 8, 10]])
c = np.concatenate((a, b), axis=0)
print(c)

Output : 
[[ 0  1  3]
 [ 5  7  9]
 [ 0  2  4]
 [ 6  8 10]]
Posted by: Guest on September-23-2020
51

combine two arrays javascript

let arr1 = [0, 1, 2];
let arr2 = [3, 5, 7];
let primes = arr1.concat(arr2);

// > [0, 1, 2, 3, 5, 7]
Posted by: Guest on February-02-2020
1

Concatenate two arrays

Array -- Concatenate two arrays
Write a return method that can concatenate two arrays
 
Solution:
public static int[] concatTwoArrays(int[] arr1 , int[] arr2) {
    int[] result = new int[arr1.length + arr2.length];
    int i = 0;
    for(int each: arr1) {
    result[i] = each;
    i++;
    }  
    for(int each: arr2) {
    result[i] =each;
    i++;
    }
    return result;
    }
Posted by: Guest on September-29-2021
0

how to concatenate two arrays

int[] z = x.Concat(y).ToArray();
Posted by: Guest on June-14-2021
0

how to concatenate two arrays

var z = new int[x.Length + y.Length];
x.CopyTo(z, 0);
y.CopyTo(z, x.Length);
Posted by: Guest on June-14-2021
0

concat two arrays

public static void main(String[] args) {

       String[] arr3 = {"A", "B", "C","Z","N"};
       String[] arr4 = {"D", "E", "F","G","U"};
ArrayList<String> list1 = new ArrayList<>();  
//  [A, B, C, Z, N, D, E, F, G, U]

       for( String each: arr3 ){
           list1.add( each );
       }
       for(String each1 : arr4  ){
           list1.add(each1);
       }
System.out.println(list1); // [A, B, C, Z, N, D, E, F, G, U]
Posted by: Guest on June-09-2021

Python Answers by Framework

Browse Popular Code Answers by Language