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.
Determining DNA Health
Determining DNA Health
Sort by
recency
|
259 Discussions
|
Please Login in order to post a comment
python3 there are 3 test cases going to failed we are using "Aho-Corasick algorithm for multi-pattern matching" code be like:
import sys from collections import deque
class TrieNode: def init(self): self.children = {} self.failure_link = None self.output = []
def build_ac_table(genes): root = TrieNode()
def search_ac_table(text, ac_table, health, first, last): current_state = ac_table # Start at the root of the Aho-Corasick Trie total_health = 0 for char in text: while current_state != ac_table and char not in current_state.children: current_state = current_state.failure_link
if name == 'main': input = sys.stdin.read data = input().split()
This test is a complete mockery. The constant spam in the comments is bad (Hey, Hackerrank, maybe a "report post" button or something? There is no plumbing to call a function, and every single test has 100000 entries that blow up your stack. This is literally a "look how smart I am" test, created by a not-too-great programmer.
Super-easy to solve with a basic trie. The only problem was the lack of proper unittests.
Add this to the body of the C++ tst
Incomplete question without the solution entry point with all the necessary input params for us to start with!?!
Here My Solusion
JavaScript: