# 2575. Find the Divisibility Array of a String ###### tags: `Leetcode` `Medium` `Math` Link: https://leetcode.com/problems/find-the-divisibility-array-of-a-string/description/ ## Code ```python= class Solution: def divisibilityArray(self, word: str, m: int) -> List[int]: rem = 0 ans = [] for _, digit in enumerate(word): rem = (rem*10+ord(digit)-ord('0'))%m if rem==0: ans.append(1) else: ans.append(0) return ans ```