What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-08-31 13:38:01
javascript copy items into another array
/* Copying arrays or parts of arrays in JavaScript */ var fruit = ["apple", "banana", "fig"]; // Define initial array. console.log(fruit); // ["apple", "banana", "fig"] // Copy an entire array ... Add solution -
Python 2021-08-30 14:14:02
stack using array python
class ArrayStack: def __init__(self): self._data = [] def __len(self): return len(self._data) def is_empty(self): return len(self._data) == 0 def push(self, e): self._data.append(e) def pop(self): if self.is_empty(): raise Empty('sta... Add solution -
Java 2021-08-30 06:02:02
string sorting in java
// how to sort string array in java without using sort method import java.util.Arrays; public class SortStringArray { public static void main(String[] args) { String[] strPlaces = {"Great Barrier Reef", "Paris", "BoraB... Add solution -
Other 2021-08-30 05:45:01
maximum element in a window of size k
#include <bits/stdc++.h> using namespace std; // A Dequeue (Double ended queue) based method for printing maximum element of // all subarrays of size k void printKMax(int arr[], int n, int k) { // Create a Double Ended Queue, Qi that will s... Add solution -
TypeScript 2021-08-30 03:20:03
java check if element exists in array
import java.util.Arrays; // For String String[] array = {"Boto", "Nesto", "Lepta"}; String toSearch = "Nesto"; // Inline if (Arrays.toString(array).contains(toSearch)) { // Do something if it's found } // Multi ... Add solution -
Javascript 2021-08-28 00:00:02
second largest number in array javascript
var secondMax = function (){ var arr = [20, 120, 111, 215, 54, 78]; // use int arrays var max = Math.max.apply(null, arr); // get the max of the array arr.splice(arr.indexOf(max), 1); // remove max from the array return Math.max.apply(nul... Add solution