← All problemsSign in

2575. Find the Divisibility Array of a String

LeetCodeArrayMathStringOpen on judge ↗

You are given a 0-indexed string word of length n consisting of digits, and a positive integer m. The divisibility array div of word is an integer array of length n such that: - div[i] = 1 if the numeric value of word[0,...,i] is divisible by m, or - div[i] = 0 otherwise. Return the divisibility array of word. Example 1: Input: word = "998244353", m = 3 Output: [1,1,0,0,0,1,1,0,0] Explanat

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start