You are viewing a single comment's thread. Return to all comments →
Java solution using Lambdas
public static int pairs(int k, List<Integer> arr) { // Write your code here Set<Integer> complementSet = ConcurrentHashMap.newKeySet(); arr.stream().forEach(f -> complementSet.add(f)); return (int) arr.parallelStream().filter(d -> complementSet.contains(k + d)).count(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
Java solution using Lambdas
}