Sort by

recency

|

12 Discussions

|

  • + 0 comments

    The code I wrote goes through test cases that I wrote myself. But submitting it gives Runtime Error. I literally wrote print(3) and the solving was accepted. And there is no solution. Literally another abandoned problem. Delete it or fix it and create test cases. Or have you already completely accepted that "leetcode" is better? Should I do the same?

  • + 0 comments

    @Admin there are no test cases for this question. Please take a look.

  • + 0 comments
    corpus = [
        "I'd like an apple.",
        "An apple a day keeps the doctor away.",
        "Never compare an apple to an orange.",
        "I prefer scikit-learn to orange.",
    ]
    
    from sklearn.feature_extraction.text import TfidfVectorizer
    import numpy as np
    
    vectorizer = TfidfVectorizer()
    sparse = vectorizer.fit_transform(corpus)
    
    # Dot product similiarities, the sentences are short!
    x = sparse * sparse.T
    
    # Skip the first document to itself and add two since documents are 1-indexed, answer: 3 (0.39ish)
    print("{0}".format(np.argmax(x[0, 1:].toarray()) + 2))
    
  • + 0 comments

    My code works while running on custom test case and gives the appropriate output but while submitting it gives Runtime Error, can somebody explain what is going on?

  • + 1 comment

    For help, you can follow up the link: https://github.com/nishant-sethi/HackerRank