Pair of Vectors - Making

I have 2 vectors, both of size n. I want to form a vector of pairs whose elements are the are corresponding values in the 2 vectors. For example:

vector 1 = [1,2,3,4,5]
vector 2 = [10, 20, 30, 40, 50]

pair of vector = [(1,10), (2,20), (3,30), (4,40), (5,50)]

I haven’t studied the concept of maps yet, so kindly provide me a way to do this without maps.

Hello @gaurisha check this:


if you have any doubt you can ask here:
Happy Learning!!

Sir, I have tried this approach. I am using CodeChef idle to solve one of their question. This code works perfectly in other idle but not in CodeChef.

I believe CodeChef idle is not accepting v1[i] notation, because every time I comment out the statements having this notation, it works otherwise, it does not.

What do I do?

Sir, I got the mistake. I did a silly code mistake. The idle is perfect. Sorry to bother.

@gaurisha can i mark this doubt as resolved?

I have already marked it as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.