Skip to content

Commit

Permalink
count unique values
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankush1oo8 committed Mar 15, 2024
1 parent bc55592 commit 1431dcd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Hashing/countUniqueElement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package Hashing;
import java.util.*;
public class countUniqueElement {
public static void main(String[] args) {
int arr[]={4,3,2,5,6,7,3,4,2,1};
HashSet<Integer>set=new HashSet<>();
for(int i=0;i<arr.length;i++){
set.add(arr[i]);
}
System.out.println(set.size());
}
}

0 comments on commit 1431dcd

Please sign in to comment.