Duplicate emails


  • 0
    N

    What is the most efficient way to find if an email is duplicate or not without having to store any of the emails that have already been received? (Pseudo-code expected)


  • 0
    R

    @nischalgprasad We can keep noting Hashcode of the Subject/body of an email and adding them into set. When a new email comes, we can check if same hashcode has been visited before or not.


  • 0
    U

    We could store a trie for the recipients. The Tire node will contain hash of the email body. Or as @rush2 suggests, we can just store hash of the body -- depends on the use case.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.