Evaluates modular arithmetic reasoning and large-integer string-processing skills in the Coding & Algorithms domain for a Data Scientist role, with an abstraction level of algorithmic fundamentals and low-level string manipulation.
You are given a very large non-negative integer represented as a decimal string s (it may be too large to fit in 64-bit types). Determine whether the integer is divisible by 8 without converting the full string to an integer type.
Constraints/assumptions:
1 <= len(s) <= 10^6
s
contains only characters
'0'..'9'
"00016"
).
Return true/false.
Examples:
s = "16"
→
true
s = "123"
→
false
s = "1000"
→
true