Minimum sum of two elements from two arrays
Submissions: 756   Accuracy:

42.29%

  Difficulty: Basic   Marks: 1

Given two arrays a[] and b[] of same size.Your task is to find minimum sum of two elements such that they belong to different arrays and are not at same index in their arrays.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. Then next two lines contains n space separated integers forming the arrays.

Output:
Output the minimum sum.
Constraints:
1<=T<=100
1<=N<=100
1<=a[i]<=1000
1<=b[i]<=1000
Example:
Input:

2
5
1 5 4 3 2
2 1 4  5 3
4
1 2 3 4
1 3 5 6
Output:
2
3

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shubham Chaudhary
Author: Shubham Chaudhary gfg


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.