Company: Harness__
Difficulty: medium
Maximum Good Pairs with K Operations Problem Description You are given an array arr of n positive integers and an integer k . The elements are to be split into pairs. Every element belongs to at most one pair, so at most n / 2 pairs can be formed, and an element may also be left unpaired. A pair is called good if the product of its two elements is not the square of any integer. Before the pairs are formed you may perform at most k operations. One operation picks an element and changes its value to any other number you like. After performing at most k operations, find the maximum number of good pairs that can be formed. Function Description Complete the function maximumGoodPairs() . It takes the following 3 parameters and returns the answer: n : an integer, the size of the array. arr : an array of n integers. k : an integer, the maximum number of elements whose value may be changed. Input Format For Custom Testing The first line contains an integer n , the size of arr . The second line