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.
Does anybody know how a sequence of genes comprised of overlaping genes should be handled?
It's not clear from the exercise if, once a sequence has
been found, if it is maximal then another should be looked
up even if it may have a lower value and is also overlapping the first sequence.
For example: gene "caaab" with gene pairs
b c aa aaa b
and health values
2 3 4 9 6
"aaa" (9) is healthier than two "aa"'s (4 * 2 = 8). Should the algorithm pick
"aaa",
"aa" + "aaa" (and the its swapped equivalent)
or the maximal value of overlapping sequences:
"aa" + "aaa" + "aa"
or "aaa" + "aa"
This looks like it could only be solved through bruteforcing
gene subsequences and check for a maximal value. The gene
lookup could be optimized using a hash table but that seems
pretty much it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Determining DNA Health
You are viewing a single comment's thread. Return to all comments →
Does anybody know how a sequence of genes comprised of overlaping genes should be handled?
It's not clear from the exercise if, once a sequence has been found, if it is maximal then another should be looked up even if it may have a lower value and is also overlapping the first sequence.
For example: gene "caaab" with gene pairs
b c aa aaa b
and health values
2 3 4 9 6
"aaa" (9) is healthier than two "aa"'s (4 * 2 = 8). Should the algorithm pick
"aaa",
"aa" + "aaa" (and the its swapped equivalent)
or the maximal value of overlapping sequences:
"aa" + "aaa" + "aa" or "aaa" + "aa"
This looks like it could only be solved through bruteforcing gene subsequences and check for a maximal value. The gene lookup could be optimized using a hash table but that seems pretty much it.