We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Sales by Match
- Discussions
Sales by Match
Sales by Match
Sort by
recency
|
340 Discussions
|
Please Login in order to post a comment
Java solution using a Integer, Boolean map. Idea is to negate whatever bool is found in the map for each value. If it isn't already in the map put false. Increment a counter when something is made true. // Write your code here HashMap map = new HashMap<>(); int pairs = 0; System.out.println(map); for(Integer i : ar){ map.put(i, !map.getOrDefault(i,true)); if(map.get(i) == true){pairs++;} } S }
}
in Js:
C#
My asnwer C#