dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
2.2 KiB
2.2 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6a15cadf5f240d05a264955c | Challenge 318: DNA Mutations | 29 | challenge-318 |
--description--
Given two DNA strands of equal length, return an array of indexes where the strands differ (mutations).
- DNA strands are strings made up of the characters
"A","T","C", and"G" - Return the indexes in ascending order
- If there are no mutations, return an empty array
--hints--
detect_mutations("ATCG", "ATGG") should return [2].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("ATCG", "ATGG"), [2])`)
}})
detect_mutations("ATGCGTACGTTAGC", "ATGCATACGATTGC") should return [4, 9, 11].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("ATGCGTACGTTAGC", "ATGCATACGATTGC"), [4, 9, 11])`)
}})
detect_mutations("GATCTAGCTAGGCTAGCTAG", "GATCTAGCTAGGCTAGCTAG") should return [].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("GATCTAGCTAGGCTAGCTAG", "GATCTAGCTAGGCTAGCTAG"), [])`)
}})
detect_mutations("TCAGATCATGGCTAGCTACGATCAGCTAGCATGCATATCGACTG", "TCAGATCATGGCTAGAGCTGATCAGCTAGCATGCATATCGACTG") should return [15, 16, 17, 18].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("TCAGATCATGGCTAGCTACGATCAGCTAGCATGCATATCGACTG", "TCAGATCATGGCTAGAGCTGATCAGCTAGCATGCATATCGACTG"), [15, 16, 17, 18])`)
}})
detect_mutations("ACGTCAGTACGCACATGACCATTGACATA", "AACGTCAGTACGCACATGACCATTGACAT") should return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 26, 27, 28].
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("ACGTCAGTACGCACATGACCATTGACATA", "AACGTCAGTACGCACATGACCATTGACAT"), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 26, 27, 28])`)
}})
--seed--
--seed-contents--
def detect_mutations(strand1, strand2):
return strand1
--solutions--
def detect_mutations(strand1, strand2):
return [i for i, (a, b) in enumerate(zip(strand1, strand2)) if a != b]