c++(4ms 99,80%) bit manipulation (with comments)
Runtime: 4 ms, faster than 99.80% of C++ online submissions for Binary Prefix Divisible By 5.\nMemory Usage: 13.9 MB, less than 62.92% of C++ online submissions
Runtime: 4 ms, faster than 99.80% of C++ online submissions for Binary Prefix Divisible By 5.\nMemory Usage: 13.9 MB, less than 62.92% of C++ online submissions for Binary Prefix Divisible By 5.\n```\nclass Solution {\npublic:\n  vector<bool> prefixesDivBy5(vector<int>& A) {\n    vector<bool> ans;\n    unsigned long rep = 0;                       //binary representation\n    for(int i = 0; i < A.size(); i++){\n      int limit = i + 60;                        //fetch 60 numbers\n      \n      for(int j = i; j != A.size() && j != limit; j++){ \n        rep = (rep<<1) | A[j] ;                  //add bit\n        if(rep%5) ans.push_back(false);          //if not divisible 5\n        else ans.push_back(true);                //if yes\n      }\n      \n      rep %= 5;                                  //take remainder \n      i = limit - 1; \n    }\n    return ans;\n  }\n};\n```
['C', 'C++']