We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Concatenate
- Discussions
Concatenate
Concatenate
Sort by
recency
|
462 Discussions
|
Please Login in order to post a comment
For Python3 Platform
My compact solution…
This was a very, very poor problem. The challenge was to take the input, make two arrays with it, then concatenate them into one. However, if the input for the two arrays is instead read into a single array, there's no need to concatenate two arrays.
With that in mind, here's a more facetious solution that doesn't use NumPy, but passes all the tests…
😛
A better problem would've been to read in two arrays, then concatenate them in the opposite order.
import numpy as np
n,m,p = map(int,input().split()) ar1 = np.array([input().split() for i in range(n)], int) ar2 = np.array([input().split() for i in range(m)], int)
print(np.concatenate((ar1,ar2), axis=0))
Here is HackerRank Concatenate in Python solution - https://programmingoneonone.com/hackerrank-concatenate-problem-solution-in-python.html