C++ 4 lines
Just build your number from the binary string. The only trick here is to track modulo 5, not the actual number, to avoid overflow.\n\nvector<bool> prefixesDivBy
Just build your number from the binary string. The only trick here is to track modulo 5, not the actual number, to avoid overflow.\n```\nvector<bool> prefixesDivBy5(vector<int>& A, vector<bool> a = {}, int num = 0) {\n  for (auto i : A) {\n    num = (num * 2 + i) % 5;\n    a.push_back(!num);\n  }\n  return a;\n}\n```
[]