Company: Netradyne
Difficulty: easy
Array transfer You have data stored as an array Arr of size N . You must transfer a subsequence of size M of that array to a client. A subsequence is obtained by deleting zero or more elements of Arr without changing the order of the remaining elements. The time taken to transfer a subsequence of size M is the product of the first and the last element of that subsequence . You do not want your client to wait, so you want the transfer time to be as small as possible. For each test case, report the minimum time the client has to wait for a subsequence of size M . Input format The first line contains an integer T , the number of test cases. For each test case: - The first line contains an integer N , the size of the array. - The second line contains an integer M , the size of the subsequence. - The third line contains N space-separated integers, the elements of Arr . Output format For each test case, print on a new line a single integer: the minimum transfer time. Constraints 1 <= T &l