vector<int>arr {1, 34 , 50, 4, 400};
int maximumElement = *max_element(arr.begin(), arr.end());
int minimumElement = *min_element(arr.begin(), arr.end());
#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];
}
#In python
#List
myListName = ["value", 3, 3.1, "a", True]
minimumValue = min(myListName)
maximumValue = max(myListName)
#Numpy array
import numpy as np
myListName = ["value", 3, 3.1, "a", True]
myArrayName = np.array(myListName)
minimumValue = min(myArrayName)
maximumValue = max(myArrayName)
Code Example |
---|
Cpp :: hexadecimal or binary to int c++ |
Cpp :: char to integer c++ |
Cpp :: how to write hello world in c++ |
Cpp :: c++ struct |
Cpp :: c++ get the line which call a function |
Cpp :: how to delete a node c++ |
Cpp :: c++ struct constructor |
Cpp :: c++ 14 for sublime windoes build system |
Cpp :: how to find something in a string in c++ |
Cpp :: c define |
Cpp :: doubly linked list in cpp |
Cpp :: opengl draw semi circle c++ |
Cpp :: ascii cpp |
Cpp :: C++ New Lines |
Cpp :: c++ initialize static variable |
Cpp :: cpp array init value |
Cpp :: SUMOFPROD2 codechef solution |
Cpp :: vector iterating in c++ |
Cpp :: initialize vector |
Cpp :: read string with spaces in c++ |
Cpp :: cpp linked list |
Cpp :: c++ insert variable into string |
Cpp :: how to make dictionary of numbers in c++ |
Cpp :: cpp read from file |
Cpp :: c++ class |
Cpp :: c++ thread wait fro 1 sec |
Cpp :: store array in vector |
Cpp :: c++ compare type |
Cpp :: tabeau pseudo dynamique sur c++ |
Cpp :: c++ map |