Answers for "maximum possible value of max of an array after k moves"

C++
5

find kth max and min element in an array

#include <bits/stdc++.h> 
using namespace std;

int main(){
  	const int size = 10;
  	int k = 3; //Can be any number smalled than size
	int array[size] = {5,2,8,34,73,82,1,6,19,29};
	sort(array,array+size);
	int smallestKthElement = array[k-1];	
	int largestKthElement = array[size-k];
}
Posted by: Guest on June-23-2021

Code answers related to "maximum possible value of max of an array after k moves"

Browse Popular Code Answers by Language