MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / divideArray

Method divideArray

DivideArrayIntoEqualPairs.java:2–12  ·  view source on GitHub ↗
(int[] nums)

Source from the content-addressed store, hash-verified

1class Solution {
2 public boolean divideArray(int[] nums) {
3 HashSet<Integer> set = new HashSet<>();
4 for(int num : nums){
5 if(set.contains(num)){
6 set.remove(num);
7 }else{
8 set.add(num);
9 }
10 }
11 return (set.size()==0);
12 }
13}

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected