What do you want to save?
Add Code snippet
New code examples
-
Other 2021-08-27 11:40:02
Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. using hashmap
import java.util.*; class Solution { public boolean uniqueOccurrences(int[] arr) { HashMap<Integer,Integer> hash = new HashMap<>(); for(int i = 0;i<arr.length;i++){ if(hash.containsKey(arr[i])){ ... Add solution