Ad
  • Default User Avatar

    Your code is probably falling into an infinite loop in some edge cases, make sure that your code can handle ties between competitors

  • Custom User Avatar
    class Tree {
      constructor(cats) { this.cats = cats; }
      getPathsOf(cat) { /* body with this.cats instead of cats .. */ return toReturn; }
    }
    

    or simply

    Object.prototype.getPathsOf = function(cat) { /* body with this instead of cats .. */ return toReturn; };
    

    In the latter case, please look into Object.defineProperty because of enumerability.

    Does this answer your question?