CT031

Similar Website Finder

HardAcceptance: 0.0%

The Codetikki web analysts have a list of (website, user) pairs representing users visiting websites. They need to find the top k pairs of websites with the greatest similarity, where similarity is the Jaccard index: the number of common users divided by the total number of users who visited either site.

Example 1:

Input: 1 18 google.com 1 google.com 3 google.com 5 pets.com 1 pets.com 2 yahoo.com 6 yahoo.com 2 yahoo.com 3 yahoo.com 4 yahoo.com 5 wikipedia.org 4 wikipedia.org 5 wikipedia.org 6 wikipedia.org 7 bing.com 1 bing.com 3 bing.com 5 bing.com 6
Output: google.com bing.com

Constraints:

1 <= number of pairs <= 10^4 1 <= k <= 100 1 <= number of websites <= 1000

Tags:

heap hash-table graph
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki