diff --git a/Hash Table/C++/Repeated DNA Sequences.cpp b/Hash Table/C++/Repeated DNA Sequences.cpp deleted file mode 100644 index 82be182..0000000 --- a/Hash Table/C++/Repeated DNA Sequences.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*Algorithm: -We will store each unique DNA sequence and its frequency in map by traversing from index 0. At last we will return all the -unique DNA sequence which are repeated by traversing map . -*/ - -#include -using namespace std; - -class Solution { -public: - vector findRepeatedDnaSequences(string s) { - - unordered_mapm; - vectorans; - - int n=s.length(); - - for(int i=0;i<=(n-10);i++) - { - m[s.substr(i,10)]++; //storing string and its frequency of length 10 - } - - for(auto x:m) //traversing map - { - if(x.second>1) //DNA is repeated - ans.push_back(x.first); - - } - - return ans; - - } -}; - - -int main() -{ - - string s; - cin>>s; - - Solution obj; - vectorans=obj.findRepeatedDnaSequences(s); - - for(int i=0;i