Out put limit exceeded ?


  • -1
    D
    vector<string> findRepeatedDnaSequences(string s) {
    unordered_map<int, int> m;
    vector<string> r;
    int t = 0, i = 0, ss = s.size();
    while (i < 9)
    t = t << 3 | s[i++] & 7;
    
    while (i < ss)
    {
      int sp=t << 3 | s[i] & 7;
      m[sp]++;
      if (m[sp] > 1)
      r.push_back(s.substr(i - 10, 10));
      i++;
    }
    return r;
    
    }

  • 0

    @dash95 Could you please just format your code properly using backquotes ```, it's really a mess here. Check this post for details. Many problems in your solution.

    If you need explanation, here is my another post.


  • 0

    But here we have to use map now, since int is too large for current situation while char is not enough for counting, which I just checked again.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.