HackerRank Concatenate problem solution in Python YASH PAL, 31 July 202417 January 2026 HackerRank Concatenate problem solution in Python – In this Concatenate problem in Python programming, you are given two integer arrays of size N X P and M X P ( N & M are rows, and P is the column). Your task is to concatenate the arrays along axis 0.Concatenate Two or more arrays can be concatenated together using the concatenate function with a tuple of the arrays to be joined:import numpy array_1 = numpy.array([1,2,3]) array_2 = numpy.array([4,5,6]) array_3 = numpy.array([7,8,9]) print numpy.concatenate((array_1, array_2, array_3)) #Output [1 2 3 4 5 6 7 8 9] If an array has more than one dimension, it is possible to specify the axis along which multiple arrays are concatenated. By default, it is along the first dimension.import numpy array_1 = numpy.array([[1,2,3],[0,0,0]]) array_2 = numpy.array([[0,0,0],[7,8,9]]) print numpy.concatenate((array_1, array_2), axis = 1) #Output [[1 2 3 0 0 0] [0 0 0 7 8 9]] HackerRank Concatenate problem solution in Python 2.import numpy N, M, P = map(int, raw_input().split()) n = numpy.array([map(int, raw_input().split()) for _ in range(N)]) m = numpy.array([map(int, raw_input().split()) for _ in range(M)]) print numpy.concatenate((n, m))Concatenate problem solution in Python 3.import numpy as npa, b, c = map(int,input().split())arrA = np.array([input().split() for _ in range(a)],int)arrB = np.array([input().split() for _ in range(b)],int)print(np.concatenate((arrA, arrB), axis = 0))Problem solution in pypy programming.# Enter your code here. Read input from STDIN. Print output to STDOUT import numpy n, m, p=map(int, raw_input().split()) g=[] for i in range(n+m): g.append(map(int, raw_input().split())) print numpy.reshape(g, (n+m, p))Problem solution in pypy3 programming.# Enter your code here. Read input from STDIN. Print output to STDOUT def matrix_printer(arr,n,m): for i in range(n): if i == 0: print('[[' + ' '.join(map(str, arr[0][0:m])) + ']') elif i == n-1: print(' [' + ' '.join(map(str, arr[n-1][0:m])) + ']]') else: print(' [' + ' '.join(map(str, arr[i][0:m])) + ']') n,m,p = map(int, input().split()) lst=[] for _ in range(n+m): lst.append(list(map(int,input().split()))) matrix_printer(lst,(n+m),p) coding problems solutions Hackerrank Problems Solutions Python Solutions HackerRankPython