|All-time Popular Problems|
|Detect cycle in an undirected graph|
|BFS traversal of graph|
|Two Mirror Trees|
|Delete nodes having greater value on right|
|Find the number of islands|
|Sum of all prime numbers between 1 and N.|
|Determine if Two Trees are Identical|
|Longest Palindrome in a String|
Given, N Mice and N holes are placed in a straight line. Each hole can accommodate only 1 mouse. A mouse can stay at his position, move one step right from x to x + 1, or move one step left from x to x -1. Any of these moves consumes 1 minute. Write a program to assign mice to holes so that the time when the last mouse gets inside a hole is minimized.
First line of input contains a single integer T which denotes the number of test cases. T test cases follows, first line of each test case contains a single integer N which denotes the number of mice and holes. Second line of each test case contains N space separated integers which denotes the position of mice initially. Third line of each test case also contains N space separated integers which denotes the position of holes.
For each test case in a new line print the minimum time required in which all the mice can get into the holes.
4 -4 2
4 0 5
-10 -79 -79 67 93 -85 -28 -94
-2 9 69 25 -31 23 50 78