|| Easy Solution || DFA ||
Intuition\nUsing Deterministic Finite Automata \n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nConstant\n\n# Code\n\nclass Solution {\n    pu
# Intuition\nUsing Deterministic Finite Automata \n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nConstant\n\n# Code\n```\nclass Solution {\n    public List<Boolean> prefixesDivBy5(int[] nums) {\n        List<Boolean> res = new ArrayList<>();\n        int daigram[][] ={{0,1},{2,3},{4,0},{1,2},{3,4}};\n        int s = 0;\n        for(int a : nums)\n        {\n            s = daigram[s][a];\n            if(s==0)\n            res.add(true);\n            else\n            res.add(false);\n        }\n        return res;\n    }\n}\n```
['Math', 'Brainteaser', 'C++', 'Java', 'Python3']