How can I make my code better and a doubt

https://ide.codingblocks.com/s/204269. this is the code but I have used lot of loops. How can I make my code efficient?
AND
why can’t I write median as;
median=( arr3.begin() + (arr3.end()-1))/2

Hi @aryaman.kumar26

To remove some loops you can take input directly into arr3 of size 2*n;

Second as both arrays have same size always, hence the total size is 2*n which is even. So you can directly equate median to n - 1 in 0 based indexing and n in 1 based indexing.

Hope it Helps.

@aryaman.kumar26
Please mark your doubt as resolved.