About 3,420,000 results
Open links in new tab
  1. Find sum of non-repeating (distinct) elements in an array

    Sep 13, 2023 · Given an integer array with repeated elements, the task is to find the sum of all distinct elements in the array. Examples: Input : arr[] = {12, 10, 9, 45, 2, 10, 10, 45,10};

  2. Find non-repetitive pairs in an array that add up to a given sum

    Jun 4, 2019 · I use Java 8 to solve this problem. Here are some codes that I tried: public static void printSumNine(int[] input) { for (int i = 0; i < input.length - 1; i++) { for (int j = i + 1; j < …

  3. java - Finding non duplicate element in an array - Stack Overflow

    Dec 31, 2014 · I have an input integer array which has only one non duplicate number, say {1,1,3,2,3}. The output should show the non duplicate element i.e. 2. So far I did the following: …

  4. Non Repeating elements in an Array in Java - PrepInsta

    IN this section we will learn how to find non-repeating elements in an array with the help of java code and its algorithm / working.

  5. java - Want non duplicate elements from list - Stack Overflow

    Mar 22, 2018 · Here is a Java 8 way without streams: Map<String, Long> counts = new HashMap<>(); list.forEach(word -> counts.merge(word, 1L, Long::sum)); …

  6. Java Program to Find Sum of Array Elements - GeeksforGeeks

    Jan 26, 2023 · Given two sorted arrays and a number x, find the pair whose sum is closest to x and the pair has an element from each array. We are given two arrays ar1[0...m-1] and …

  7. Find duplicate elements in an array - GeeksforGeeks

    Dec 19, 2024 · Given an array of n integers. The task is to find all elements that have more than one occurrences. The output should only be one occurrence of a number irrespective of the …

  8. Java How To Calculate the Sum of Array Elements - W3Schools

    Get the sum of array elements: sum += myArray[i]; } System.out.println("The sum is: " + sum); Well organized and easy to understand Web building tutorials with lots of examples of how to …

  9. How do you find the sum of all the numbers in an array in Java?

    Dec 29, 2010 · import org.apache.commons.math3.stat.StatUtils; public class ArraySum { public static void main(String[] args) { double[] array = { 10, 4, 17, 33, -2, 14 }; int sum = …

  10. Write a java program to remove duplicate elements and calculate the sum ...

    Sep 29, 2018 · Write a program to read an array, eliminate duplicate elements and calculate the sum of even numbers (values) present in the array.

  11. Some results have been removed
Refresh