All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: “ACGAATTCCG”. When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.
Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.
Input:
s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
Output: ["AAAAACCCCC","CCCCCAAAAA"]
def DNAseq(seqce): n=len(seqce) d={} temp=[] for i in range(n): sub=seqce[i:i+10] d[sub]=d.get(sub,0)+1 for key,val in d.items(): if val>1: temp.append(key) return temp seq=input('Enter the Sequence : ') print(DNAseq(seq))
Input_1:
Enter the Sequence : AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT
Output:
CCCCCAAAAA AAAAACCCCC
Input_2:
Enter the Sequence : AAAAAAAAAAAAA
Output:
AAAAAAAAAA
ILLUSTRATION OF THE OUTPUT
![](http://www.fcukthecode.com/wp-content/uploads/2021/12/Screenshot-from-2021-12-10-19-37-33.png)
More Q
- Determine if a person could attend all meetings in given interval times.
- Find the volume of a volley ball
- Find the maximum score obtained at the end of colour chess grid game.
- Find the number of pairs if positive integers with condition is even.
- Return the largest subset such that every pair meets the given condition.
- Find the number of index triplets that satisfy given condition.
- Handling multiple queries using array – sum, update, range.
- Find all the sequences that occur more than once in DNA molecule.
- Find the biggest number.
- Sum of cube of each number is again equal to the number then it is an Armstrong number.
- Hello World.
- Calculate the Cube Root.
- Find the count of consecutive 1’s present in array.
- Return an array with athletes relative ranks according to the score.
- Return a string of its base 7 representation.
- Return kth largest element in sorted order.
- Find all repeated elements in the array.
- Find atleast one duplicate number in the array.
- Find the maximum result of = a XOR b.