Computers and Technology
You are given an array of integers. Your task is to create pairs of them, such that every created pair has the same sum. This sum is not specified, but the number of created pairs should be the maximum possible. Each array element may belong to one pair only.Write a functionclass Solution public intsolution (int[] A); }that, given an array A consisting of N integers, returns the maximum possible number of pairs with the same sum.Examples:1. Given A = [1, 9, 8, 100, 2], the function should return 2. The pairs are (A[0]. A[1]) and (A[2], A[4]); the sum of each pair is 10.2. Given A = [2, 2, 2, 3], the function should return 1. Although, for instance, A[0]+A[1] = A[0]+A[2], the pairs (A[0], A[1]) and (A[0], A[2]) cannot exist at the same time, because they both contain a common element, A[0].
Arrange the following steps in an appropriate order for program execution: - Step A: translates the source code into the target machine code - Step B: preprocesses the source code - Step C: writes the source code - Step D: links object code to other library filesWhich one is correct:A) D, C, B, AB) C, A, D, BC) A, B, C, DD) C, B, A, D
Matching parentheses. An math expression may have a number of parentheses like (, ), [, ], { and }. Each openning parenthesis (, or [, or { must be macthed by a corresponding closing parenthsis ), or ] or }. For example, 12 { 34 / [ 6 * ( 55 - 10 ) / ( 100 20 ) ] } has matched pairs of parentheses, while 12 { 34 / ( 6 * ) ] } does not. Write a function to check whether an input math expression has matched parentheses. The header of the function is given as follows: bool match( const char exp [ ], const int s); The input math express is store in the char array exp, and the size of exp is s. It returns true if all parentheses are matched or false otherwise.