-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion 69
More file actions
35 lines (32 loc) · 617 Bytes
/
question 69
File metadata and controls
35 lines (32 loc) · 617 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int x=sc.nextInt();
while(x-->0) {
int a=sc.nextInt();
int b[]=new int[a];
int c[]=new int[a];
for(int i=0;i<a;i++) {
b[i]=sc.nextInt();
}
for(int i=0;i<a;i++) {
c[i]=sc.nextInt();
}
Arrays.sort(b);
Arrays.sort(c);
int m=a-1,sum=0,max=0;
for(int i=0;i<a;i++) {
sum=b[i]+c[m];
if(max<=sum)
max=sum;
sum=0;
m--;
}
System.out.println(max);
}
}
}