---
id: 6a15cadf5f240d05a264955c
title: "Challenge 318: DNA Mutations"
challengeType: 29
dashedName: 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]`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("ATCG", "ATGG"), [2])`)
}})
```

`detect_mutations("ATGCGTACGTTAGC", "ATGCATACGATTGC")` should return `[4, 9, 11]`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("ATGCGTACGTTAGC", "ATGCATACGATTGC"), [4, 9, 11])`)
}})
```

`detect_mutations("GATCTAGCTAGGCTAGCTAG", "GATCTAGCTAGGCTAGCTAG")` should return `[]`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(detect_mutations("GATCTAGCTAGGCTAGCTAG", "GATCTAGCTAGGCTAGCTAG"), [])`)
}})
```

`detect_mutations("TCAGATCATGGCTAGCTACGATCAGCTAGCATGCATATCGACTG", "TCAGATCATGGCTAGAGCTGATCAGCTAGCATGCATATCGACTG")` should return `[15, 16, 17, 18]`.

```js
({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]`.

```js
({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--

```py
def detect_mutations(strand1, strand2):

    return strand1
```

# --solutions--

```py
def detect_mutations(strand1, strand2):
    return [i for i, (a, b) in enumerate(zip(strand1, strand2)) if a != b]
```
