the array n integer give Lets sequence consecutive element segment also let segment kgood contain k different valuesFind long kgood segmentAs inputoutput reach huge size recommend use fast inputoutput method example prefer use scanfprintf instead cincout c prefer use bufferedreaderprintwrit instead ScannerSystemout Java