What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-09 00:05:13
length vs length() method in java
length() : In String class we have length() method which is used to return the number of characters in string. Ex : String str = “Hello World”; System.out.println(str.length()); Str.length() will return 11 characters including space. leng... Add solution -
Other 2022-01-29 04:07:09
how to insert an element from an array
int main() { int array[100], position, c, n, value; printf("Enter number of elements in array\n"); scanf("%d", &n); printf("Enter %d elements\n", n); for (c = 0; c < n; c++) scanf("%d"... Add solution -
Javascript 2022-01-26 02:46:21
javascript, reduce
const sum = array.reduce((accumulator, element) => { return accumulator + element; }, 0); // An example that will loop through an array adding // each element to an accumulator and returning it // The 0 at the end initializes accumulator to start at ... Add solution -
Javascript 2022-01-22 09:30:02
remove object from array of objects based on object property javascript
var myArray = [ {field: 'id', operator: 'eq', value: id}, {field: 'cStatus', operator: 'eq', value: cStatus}, {field: 'money', operator: 'eq', value: money} ]; // only keep objects in array where obj.field !== 'money' myArray = myArray.filt... Add solution -
Java 2021-10-26 08:51:12
count occurrences in seven integers using java single dimension arrays
import java.util.Scanner; public class SevenNumbersCount { public static int count(int[] arr, int num) { int count = 0; for(int i = 0; i < arr.length; ++i) { // go through all elements in array if(arr[i] == num) { //... Add solution -
Java 2021-10-07 05:42:04
length and length() method in java
length() : In String class we have length() method which is used to return the number of characters in string. Ex : String str = “Hello World”; System.out.println(str.length()); Str.length() will return 11 characters including space. leng... Add solution -
Java 2021-09-28 08:29:02
ArrayList iterator() method in java
import java.util.ArrayList; import java.util.Iterator; public class ArrayListIteratorMethodExample { public static void main(String[] args) { ArrayList<String> fruits = new ArrayList<String>(7); fruits.add("banana")... Add solution -
Javascript 2021-09-19 03:38:02
reduce javascript
const sum = array.reduce((accumulator, element) => { return accumulator + element; }, 0); // An example that will loop through an array adding // each element to an accumulator and returning it // The 0 at the end initializes accumulator to start at ... Add solution -
TypeScript 2021-09-17 12:54:02
Write a C program to count total number of duplicate elements in an array.
/** * C program to count total number of duplicate elements in an array */ #include <stdio.h> #define MAX_SIZE 100 // Maximum array size int main() { int arr[MAX_SIZE]; int i, j, size, count = 0; /* Input size of array */ prin... Add solution