unique numbers in array java

Solutions on MaxInterview for unique numbers in array java by the best coders in the world

showing results for - "unique numbers in array java"
Erica
12 Feb 2017
1int [] arr = {1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,};
2
3for (int j= 0; j < arr.length; j++){
4int count1 = 0; // to find out how many time value is appeared in the arry
5for (int i = 0; i < arr.length; i++){
6     if(arr[i] == arr[j] ) {    
7    // if(arr[i] == 1 ) { once boyleydi ikinci for gelince soldaki oldu
8      count1++; // arraydeki harfleri tek tek saymak icin
9  }
10 }
11    if(count1 == 1 ){
12    System.out.print(arr[j]+" ");// 6 7 8 uniqe
13 }
Daniela
29 Jul 2017
1import java.util.ArrayList;
2
3public class UniqueNumbersInArray {
4
5    public static void main(String[] args) {
6
7
8    int arr[] = { 4,5,5,4,5,6,5,8,4,7};
9
10        ArrayList<Integer> uniqueArr = new ArrayList<Integer>();
11        for (int i = 0; i < arr.length; i++) {
12
13            int k = 0;
14            if (!uniqueArr.contains(arr[i])){
15                uniqueArr.add(arr[i]);
16                k++;
17
18                for (int j = i; j < args.length ; j++) {
19                    if (arr[i]==arr[j]){
20                        k++;
21                    }
22                }
23
24                System.out.println(arr[i]);
25                System.out.println(k);
26            }
27
28        }
29    }
30}
queries leading to this page
keep unique values in array javascriptset to get unique values from arrayfind array unique elementfind unique properties in an arraycreate an array of unique valuesfind unique number in array javahow to return only the unique values in arraycreate an array of unique elements from arraymphp make array uniquefind unique numbers in an array jsfind unique element fro the array using bit manipulation in javadistinct elements in array javaget unique element in arrayhow many unique number in array javahow to make elements of an array uniquemake array uniquenumber of unique values in arrayunique values array javascripthow to find unique elements in arrayget unique values from array javaarray filter unique numbersfind unique values in an array javascriptunique values in javascript arrayget unique values from array using javasave unique value in array java 5cget unique values from array in javascripthow to get only unique values in the arrayhow to find number of subarrays with unique elements in an arrayunique integer arrayunique numbers in arrayunique value in array javascriptfinding unique elements in an array in javascriptfind unique element in array javascriptan array for which you have to print all unique elements in that arrayfind the unique element in an array javaget unique values from arrayjavascript find unique values in arrayhow you check all number are unique in a arrayget unique elements from array javais there any way the array return a unique valuesnumber of unique items in arraymakaroo unique number in an arrayget unique items from array javascriptfind unique elements in array javajava find unique elements in arrayhow to take out unique numbers in an arrayarray allow unique numberscode to find unique elements in an arrayunique element in new arrayfind unique elements in arrayjs find unique in arrayfilter all the unique elements in array in javajavascript get unique values from arrayfind unique values in array javafind unique values in arraymake numbers in an array uniquefinding unique elements in an array jshow to find uniques items from an arrayfind a unique number in an java arrayhow to make array values digits to be uniquejava unique string in arrayhow to get unique values from array in jsdisplay unique value in an array javahow to find unique values in array javascriptget unique values from array in javafind unique numbers in array javahow to find unique number in arrayhow to find 3 unique number in arrayunique elements of array onlyhow to fill an array with unique number in javascriptfind unique elements in array in javareturn uniqe numbers from an arrayhow to get unique items in an arrayreturn unique numbers in an array jscode to find unique element in a an array 5bprint unique elements in array in javahow to see if a number is unique without arrays in javahow to keep unique values in array javascriptgiven an array of integers 2ccreate 2 dimensional arrray where the first elemnet is a distinct values from the array and second element is that value frequency with the arrayget unique values from array javascriptarray count unique valuescheck for unique values in an array find the unique elements in the array how to find unique elements in array javascriptunique in arrygenerate an array where all alements are uniquehow to find number of unique elements in an arraymake an array unique by increments of 1 eachhow many unique values in arrayprogram to find unique elements in an array in javajavascript array unique valuesarray count uniqueunique number printing from an array in javapring unique value in arrayhow to find uniqueness of arrayhow to find unique values in array without new arrayreturn unique values in array javascriptunique numbers in array javafind a unique number in an arrayunique elements in array javafind out no of unique integers in a arrayhow to return unique items of an array in javascriptjavascript array get uniquesfind unique number in arraycount unique values in an array jsfind all the unique values in arrayfind unique element in array javahow to create an array of unique values from an existing arryahow to get unique values from array javascriptfind unique elements in array as true false in javaunique element in array javahow to take out unique numbers in an arraureturn unique values from array javascriptfind unique in array javascriptjava program to get unique elements in an arrayn 3e 1 array elements are uniquecount unique numbers in unsorted array javaget unique values array javascriptunique values in array javascripthow to return only unique values in array javascripthow to get unique values in javascript arraycount unique elements in array javascriptunique values in array jsunique elements array c 2b 2bhow to store unique values in array in node jscreate new array with unique valuesno of unique elements in arraywhich returns an array of all of the unique valuesjava find unique elements in array without a new arrayunique element in an integer arrayget unique values from an arrayjs array get unique valuesprint unique value form array in jsunique elements in array java booleanunique arrayarray unique in javaarray uniqueunique elements in array c 2b 2bunique values in an arrayhow to set only unique values in array in javascriptuniqueness of integer array in javasave unique value in array javacount unique values in javascript arrayhow to extract unique values in an arraydisplay unique values in an array javafind unique values in array javascripthow to geta all unique values in an arrayhow to find unique elements in array in javahow to get the unique values from an array in javascripthow to remain unique values in an array in javahow to get unique values in an array javascriptfind the unique items in an array 23unique elements in array in java how to find unique values in arrayget unique values in arraycount unique element in an arrayarray with unique values javascriptshow only the unique numbers in an arrayget unique items of array javaget uniques values from arrayfinding unique items in array list in javaarray inside array unique valuescount unique values array javacount unique values in array javascriptunique elements in array javascriptunique values from array javascriptjavascript array get unique valuesarray unique values javascriptarray only unique values javascriptunique elements in arrayget unique elements in an arraunique int arrayfind unique values in javascript arraycount unique values arrayunique numbers in array java