Given a set of N nuts of different sizes and N bolts of different sizes. There is a one-one mapping between nuts and bolts. Match nuts and bolts efficiently. Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means nut can only be compared with bolt and bolt can only be compared with nut to see which one is bigger/smaller. Input: The first line contains 'T' denoting the number of testcases. Then follows description of T testcases: Each case begins with a single positive integer N denoting the number of nuts/bolts. Then follows the array of nuts, each element separated by a space. And finally the bolts array, again, each element is separated by a space here. Array of Nuts/Bolts can only consist of the following elements:{'@', '#', '$', '%', '^', '&', '~', '*', '!'}. And no element can be repeated. Output: For each test case, output the matched array of nuts and bolts in separate lines, where each element in the array is separated by a space. Print the elements in the following order ! # $ % & * @ ^ ~ Constraints: 1 <= T <= 70 1 <= N <= 9 Example: Input: 2 5 @ % $ # ^ % @ # $ ^ 9 ^ & % @ # * $ ~ ! ~ # @ % & * $ ^ ! Output: # $ % @ ^ # $ % @ ^ ! # $ % & * @ ^ ~ ! # $ % & * @ ^ ~ ** For More Input/Output Examples Use 'Expected Output' option **
Given an array A[] of N positive integers which can contain integers from 1 to N where elements can be repeated or can be absent from the array. Your task is to count frequency of all elements from 1 to N.\r\n\r\nNote: Expected time complexity is O(n) with O(1) extra space.\r\n\r\nInput:\r\nFirst line of input contains an integer T denoting the number of test cases. For each test case, first line contains an integer N denoting the size of array. The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.\r\n\r\nOutput:\r\nFor each test case, output N space-separated integers denoting the frequency of each element from 1 to N.\r\n\r\nConstraints:\r\n1 ≤ T ≤ 100\r\n1 ≤ N ≤ 106\r\n1 <= A[i] <= 106\r\n\r\nExample:\r\nInput:\r\n2\r\n5\r\n2 3 2 3 5\r\n4\r\n3 3 3 3\r\n\r\nOutput:\r\n0 2 2 0 1\r\n0 0 4 0\r\n\r\nExplanation:\r\nTestcase 1: Counting frequencies of each array elements, we have:\r\n1 occurring 0 times.\r\n2 occurring 2 times.\r\n3 occurring 2 times.\r\n4 occurring 0 times.\r\n5 occurring 1 time.\r\n \r\n\r\n** For More Input/Output Examples Use 'Expected Output' option **\r\nContributor: Harshit Sidhwa\r\n