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.
Sherlock and Pairs
Sherlock and Pairs
+ 0 comments in c++, remember to change the result variable in the main() function long long result = solve(a);
+ 0 comments from collections import Counter def solve(a): c = Counter(a) count = 0 for i in c.values(): count += i*(i-1) return count
+ 0 comments a python3 solution
from collections import Counter def solve(a): C = Counter(a) return sum(n*(n-1) for n in C.values())
+ 0 comments For those who are trying in Java 8, you will need to change the given method to work with
long
and notint
.You also need to change that in the main, that is automatically generated by Hacker Rank.
+ 0 comments Can anyone help what is wrong with the following code. Only three out of 17 cases are working. https://www.hackerrank.com/challenges/sherlock-and-pairs/submissions/code/288605771
Load more conversations
Sort 131 Discussions, By:
Please Login in order to post a comment