What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-11 11:40:06
void employee::sort(emp*e , int n)
void employee::sort(emp*e , int n) Add solution -
PHP 2022-02-06 18:20:09
php sort array by key
$inventory = array( array("type"=>"fruit", "price"=>3.50), array("type"=>"milk", "price"=>2.90), array("type"=>"pork", "price"=>5.43), )... Add solution -
Javascript 2022-02-06 08:50:05
js sort array of objects
const books = [ {id: 1, name: 'The Lord of the Rings'}, {id: 2, name: 'A Tale of Two Cities'}, {id: 3, name: 'Don Quixote'}, {id: 4, name: 'The Hobbit'} ] books.sort((a,b) => (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0)); Add solution -
Other 2022-02-03 11:36:54
maximum number from Array
---without sort method--- public static int maxValue( int[] n ) { int max = Integer.MIN_VALUE; for(int each: n) if(each > max) max = each; return max; ---with sort method--- public static int maxValue( int[] n ) { Arrays.sort( n ); return... Add solution -
C++ 2022-02-02 20:41:55
sort vector in descending order
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> v = { 10, 9, 8, 6, 7, 2, 5, 1 }; sort(v.begin(), v.end(), greater <>()); } Add solution
Best helpers
Ranking is empty