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.
I implemented this approach but in C#, using a int,int Dictionary to store the counted items and their count. each item can be paired with multiple items, i count this possible pairs and add that count to the sum.
space and time complexity is O(n).
Cookie support is required to access HackerRank
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 →
I implemented this approach but in C#, using a int,int Dictionary to store the counted items and their count. each item can be paired with multiple items, i count this possible pairs and add that count to the sum. space and time complexity is O(n).