Leetcode 1018. Binary Prefix Divisible By 5

Posted 周洋的Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode 1018. Binary Prefix Divisible By 5相关的知识,希望对你有一定的参考价值。

class Solution:
    def prefixesDivBy5(self, A: List[int]) -> List[bool]:
        ans,t = [],0
        for a in A:
            t = (t * 2 + a)%5
            ans.append(False if t else True)
        return ans

 

以上是关于Leetcode 1018. Binary Prefix Divisible By 5的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode --- 1018. Binary Prefix Divisible By 5 解题报告

LeetCode --- 1018. Binary Prefix Divisible By 5 解题报告

Leetcode 1018. Binary Prefix Divisible By 5

LeetCode.1018-可被5整除的二进制数(Binary Prefix Divisible By 5)

(二叉树 递归) leetcode 889. Construct Binary Tree from Preorder and Postorder Traversal

leetcode 67. ???????????????(Add Binary)