Practice UTF-8 Validation
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Return whether data represents valid UTF-8 byte patterns. A one-byte character starts with bit 0. A character using n bytes, for n from 2 through 4, starts with n one-bits followed by 0; each remaining byte starts with 10. Parse the full sequence into such characters, rejecting missing or unexpected continuation bytes. Only the lowest eight bits of each data value are used.
Source: UTF-8 Validation on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
data = [197,130,1]
true
# Example 2
data = [235,140,4]
false
Constraints
Related LeetCode Problems
Practice more problems similar to UTF-8 Validation.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.