What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-08 16:29:12
map in javascript
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution -
C++ 2021-11-07 01:16:09
get elements of 2d array c++
#include <array> 2 #include <iostream> 3 4 using namespace std; 5 6 //remember const! 7 const int ROWS = 2; 8 const int COLS = 3; 9 10 void printMatrix(array<array<int, COLS>, ROWS> matrix){ 11 //for each row 12 for (int row = 0; r... Add solution -
Javascript 2021-11-05 08:35:19
map function javascript
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution -
Javascript 2021-11-02 12:11:12
reduce function snippets
/* The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value.*/ // Round all the numbers in an array, and display the sum: <button onclick="myFunction()">Get the Su... Add solution -
Python 2021-11-02 11:17:11
exchange sort python
The exchange sort compares each element of an array and swap those elements that are not in their proper position, just like a bubble sort does. The only difference between the two sorting algorithms is the manner in which they compare the elements. The ... Add solution -
Other 2021-10-25 19:00:14
how to make an array of arrays unity
//creates an array of arrays int[][] myarray; //creates an array which contains 20 arrays the arrays are all empty and unitialized, they will need to be initialized, there is currently just 20 starting points reserved in memory. They point to nothing re... Add solution -
Javascript 2021-10-23 20:41:07
array map javascript
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution -
Python 2021-10-23 17:49:12
how to convert adjacency list to adjacency matrix
#Python: def convert_to_matrix(graph): matrix = [] for i in range(len(graph)): matrix.append([0]*len(graph)) for j in graph[i]: matrix[i][j] = 1 return matrix #the lst shows in a form of each index(each inner list)... Add solution
Best helpers
Maryam Abbas
+5
Welfare
+5
Realdeo
+5
Ray Harris
+5
JCM
+5
TJ Lee
+5
Paola
+5
Daniel w
+5
Interlocutor
+5
Kester
+5
Niall Beag
+5
Calbertts
+5
Krishter
+5
Zeynel
+5