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.
- Prepare
- Algorithms
- Greedy
- Beautiful Pairs
- Discussions
Beautiful Pairs
Beautiful Pairs
Sort by
recency
|
292 Discussions
|
Please Login in order to post a comment
Here's my java solution
public static int beautifulPairs(List A, List B) { // Write your code here //frequency map for A Map freqMapA = A.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
Here is my Python solution!
Here is my c++ solution, you can watch the explanation here : https://youtu.be/coANgIdBKAk
My Java solution with linear time complexity and linear space complexity: